Integration made easy with Apache Camel
- 2. Agenda
• What is Apache Camel?
• Live Demo
• What’s in the box?
• Deploying and Testing Camel
• Q & A
- 3. 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
- 4. 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.
- 5. 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"
- 15. Content Based Router
Endpoint newOrder = endpoint("activemq:queue:newOrder");
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget)
- 16. 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)
- 17. 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)
- 18. 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();
}
- 19. Java Code
import 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();
}
}
- 20. Camel Java DSL
import 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();
}
}
- 21. 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>
- 22. 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
- 23. 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
- 26. 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
- 30. 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
- 36. 5+ DSL
●
Java DSL
●
XML DSL (Spring and OSGi Blueprint)
●
Groovy DSL
●
Scala DSL
●
Kotlin DSL (work in progress)
- 40. Agenda
• What is Apache Camel?
• Live Demo
• What’s in the box?
• Deploying and Testing Camel
• Q & A
- 44. What next?
●
Buy the “Camel in Action” book
●
Visit the web site - camel.apache.org
●
Go through the examples
●
Experiment…
http://manning.com/ibsen