20

Apache camel

Embed Size (px)

Citation preview

Page 1: Apache camel
Page 2: Apache camel

What does Camel stand for?

ConciseApplicationMessagingExchangeLanguage

Page 3: Apache camel

About Me

12 years in Software Industry Build software in Project Management, CAD/CAM, Banking, Education,

Ecommerce C++,C #.Net, Java, Scala, Akka, Spring, Node.JS, Vert.x, RDBMS,

MongoDB www.Marutsingh.com

Page 4: Apache camel

What is Apache Camel

Quote from the web site http://camel.apache.org

Apache Camel is apowerful Open SourceIntegration Frameworkbased on knownEnterprise Integration Patterns

Page 5: Apache camel

What is Apache Camel

Why do we need integration? Your apps are build using different tech stacks Critical for your business to integrate

Why Integration Framework? Framework do the heavy lifting Focus on business problem Not "reinventing the wheel"

Page 6: Apache camel

What is Apache Camel

What is Enterprise Integration Patterns?

Page 7: Apache camel

What is Apache Camel

Use Case

ActiveMQ REST Api

Page 8: Apache camel

What is Apache Camel

What is Enterprise Integration Patterns?

Page 9: Apache camel

EIP

Page 10: Apache camel

Filter Pattern

fromA

send toB

filtermessage

Page 11: Apache camel
Page 12: Apache camel

Camel’s architecture

Page 13: Apache camel

Filter Route

Endpoint A = endpoint("activemq:queue:quote");

Endpoint B = endpoint("mq:quote");Predicate isWidget =

xpath("/quote/product = ‘widget’");

from(A).filter(isWidget).to(B);

Page 14: Apache camel

Filter Route

import org.apache.camel.builder.RouteBuilder;

public class FilterRoute extends RouteBuilder {

public void configure() throws Exception { Endpoint A = endpoint("activemq:queue:order"); Endpoint B = endpoint("mq:inventory"); Predicate isWidget = xpath("/quote/product = ‘widget’");

from(A).filter(isWidget).to(B); }}

Page 15: Apache camel

Content Based Router

Page 16: Apache camel

Content Based Route – Java DSL

from("activemq:orders") .choice() .when() .jsonpath(“$..order[[email protected]==’cod’)]”) .to("activemq:codOrders") .otherwise() .to("activemq:prepaidOrders");

Page 17: Apache camel

Camel Components

Page 18: Apache camel

Summary Integration framework > 180 components out of the box Enterprise Integration Patterns (EIP) Routing and mediation Domain Specific Language (DSL) Endpoints as URIs Predicate and Expressions Very extensible and configurable No heavy specification No container dependency Payload agnostic Connectivity to a great wealth of transports Apache licensed

Page 19: Apache camel

Code Example

Goals 1) Pickup files from a directory 2) Make sure we only pickup 3 files per 30 seconds 3) Store into JMS queue 4) Listen on JMS queue 5) And upload file to FTP server

Page 20: Apache camel

Goals using Enterprise Integration Patterns

from throttle to from to