integration made easy with apache camel
TRANSCRIPT
Agenda• What is Apache Camel?
– Enterprise Integration Patterns– Java and XML DSLs– Architecture
• Live Demo• What’s in the box?• Deploying and Testing Camel• Q & A
What is Apache Camel?
http://camel.apache.org/what-is-camel.html
Apache Camel™ is a versatile open-source integration framework based on known Enterprise Integration Patterns.
What is Apache Camel?● Why do we need integration?
● Critical for your business to integrate
● Why Integration Framework?
● Framework do the heavy lifting
● You can focus on business problem
● Not "reinventing the wheel"
Enterprise Integration Patterns
http://www.enterpriseintegrationpatterns.com
● It’s a book
● Contains 65 integration patterns
● Provides a consistent vocabulary and visual notation to describe large-scale integration solutions across many implementation technologies
Content Based Router
Endpoint newOrder = endpoint("activemq:queue:newOrder");
from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget)
Content Based Router
Endpoint newOrder = endpoint("activemq:queue:newOrder"); Predicate isWidget = xpath("/order/product = 'widget'");
from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget)
Content Based Router
Endpoint newOrder = endpoint("activemq:queue:newOrder"); Predicate isWidget = xpath("/order/product = 'widget'"); Endpoint widget = endpoint("activemq:queue:widget"); Endpoint gadget = endpoint("activemq:queue:gadget");
from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget)
Content Based Router
public void configure() throws Exception { Endpoint newOrder = endpoint("activemq:queue:newOrder"); Predicate isWidget = xpath("/order/product = 'widget'"); Endpoint widget = endpoint("activemq:queue:widget"); Endpoint gadget = endpoint("activemq:queue:gadget"); from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget) .end(); }
Java Codeimport org.apache.camel.Endpoint;import org.apache.camel.Predicate;import org.apache.camel.builder.RouteBuilder;
public class MyRoute extends RouteBuilder {
public void configure() throws Exception { Endpoint newOrder = endpoint("activemq:queue:newOrder"); Predicate isWidget = xpath("/order/product = 'widget'"); Endpoint widget = endpoint("activemq:queue:widget"); Endpoint gadget = endpoint("activemq:queue:gadget");
from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget) .end(); }}
Camel Java DSLimport org.apache.camel.Endpoint;import org.apache.camel.Predicate;import org.apache.camel.builder.RouteBuilder;
public class MyRoute extends RouteBuilder {
public void configure() throws Exception { from("activemq:queue:newOrder") .choice() .when(xpath("/order/product = 'widget'")) .to("activemq:queue:widget") .otherwise() .to("activemq:queue:gadget") .end(); }}
Camel XML DSL
<route> <from uri="activemq:queue:newOrder"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:queue:widget"/> </when> <otherwise> <to uri="activemq:queue:gadget"/> </otherwise> </choice> </route>
Camel XML DSL
<route> <from uri="file:inbox/orders"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:queue:widget"/> </when> <otherwise> <to uri="activemq:queue:gadget"/> </otherwise> </choice> </route>
use file instead
Camel XML DSL
<route> <from uri="file:inbox/orders?delete=true"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:queue:widget"/> </when> <otherwise> <to uri="activemq:queue:gadget"/> </otherwise> </choice> </route>
parameters
Quick Summary● Integration Framework
● Enterprise Integration Patterns (EIP)
● Routing (using DSL)
● Easy Configuration (endpoints as URIs)
● Payload Agnostic
● No Container Dependency
● 120+ Components (connectors)
Agenda• What is Apache Camel?• Live Demo
– File example using Eclipse– Console example– More examples…
• What’s in the box?• Deploying and Testing Camel• Q & A
Agenda• What is Apache Camel?• Live Demo• What’s in the box?
– EIP, Components, Data Formats, EL– Domain Specific Languages– Testing and Managing Applications
• Deploying and Testing Camel• Q & A
5+ DSL
● Java DSL
● XML DSL (Spring and OSGi Blueprint)
● Groovy DSL
● Scala DSL
● Kotlin DSL (work in progress)
What Else?● Interceptors
● Security
● Route Policy
● Type Converters
● Transaction
● Asynchronous non-blocking routing engine
● Thread management
● Maven Tooling... and much, much more
Deploying Camel● Deployment Strategy
● No Container Dependency
● Lightweight & Embeddable
● Deployment Options
● Standalone
● WAR
● Spring
● JEE, OSGi, Cloud
What next?
● Buy the “Camel in Action” book
● Visit the web site - camel.apache.org
● Go through the examples
● Experiment…
http://manning.com/ibsen