In this session will teach you how to get a good start with Apache Camel. We will introduce you to Apache Camel and how Camel its related to Enterprise Integration Patterns. And how you go about using these patterns in Camel routes, written in Java code or XML files.
We will then discuss how you can get started developing with Camel, and how to setup new projects from scratch using Maven and Eclipse tooling.
This session includes live demos that show how to build Camel applications in Java, Spring, OSGi Blueprint and alternative languages such as Scala and Groovy. You will also hear what other features Camel provides out of the box, which can make integration much easier for you.
We also take a moment to look at hawtio, then hot new web console tooling that allows you to get insight into your running Apache Camel applications, which has among others visual route diagrams with tracing/debugging and profiling capabilities.
Before opening up for QA, we will share useful links where you can dive into learning more about Camel.
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Getting started with Apache Camel - jDays 2013
1. Getting started with Apache Camel
Claus Ibsen (@davsclaus)
Principal Software Engineer, Red Hat
jdays.se, november 2013
1
PUBLIC PRESENTATION | CLAUS IBSEN
2. Your Speaker
●
Principal Software Engineer at Red Hat
●
Apache Camel
●
5 years working full-time with Camel
●
Author of Camel in Action book
●
Contact
●
●
Twitter: @davsclaus
●
Linkedin: davsclaus
●
2
EMail: cibsen@redhat.com
Blog: http://davsclaus.com
PUBLIC PRESENTATION | CLAUS IBSEN
3. Agenda
●
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
Hawtio – Camel Tooling
●
3
What is Apache Camel?
Q and A
PUBLIC PRESENTATION | CLAUS IBSEN
4. What is Apache Camel?
●
4
Quote from the website
PUBLIC PRESENTATION | CLAUS IBSEN
5. What is Apache Camel?
●
Why do we need integration?
●
●
Critical for your business to integrate
Why Integration Framework?
●
●
You can focus on business problem
●
5
Framework do the heavy lifting
Not "reinventing the wheel"
PUBLIC PRESENTATION | CLAUS IBSEN
6. What is Apache Camel?
●
What is Enterprise Integration Patterns?
It's a book
6
PUBLIC PRESENTATION | CLAUS IBSEN
7. What is Apache Camel?
●
Enterprise Integration Patterns
http://camel.apache.org/eip
7
PUBLIC PRESENTATION | CLAUS IBSEN
8. What is Apache Camel?
●
8
EIP - Content Based Router
PUBLIC PRESENTATION | CLAUS IBSEN
9. What is Apache Camel?
from newOrder
9
PUBLIC PRESENTATION | CLAUS IBSEN
10. What is Apache Camel?
from newOrder
choice
10
PUBLIC PRESENTATION | CLAUS IBSEN
11. What is Apache Camel?
from newOrder
choice
when isWidget to widget
11
PUBLIC PRESENTATION | CLAUS IBSEN
12. What is Apache Camel?
from newOrder
choice
when isWidget to widget
otherwise to gadget
12
PUBLIC PRESENTATION | CLAUS IBSEN
13. What is Apache Camel?
from(newOrder)
choice
when(isWidget) to(widget)
otherwise to(gadget)
13
PUBLIC PRESENTATION | CLAUS IBSEN
14. What is Apache Camel?
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget);
14
PUBLIC PRESENTATION | CLAUS IBSEN
15. What is Apache Camel?
Endpoint newOrder = endpoint("activemq:queue:newOrder");
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget);
15
PUBLIC PRESENTATION | CLAUS IBSEN
16. What is Apache Camel?
Endpoint newOrder = endpoint("activemq:queue:newOrder");
Predicate isWidget = xpath("/order/product = 'widget'");
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget);
16
PUBLIC PRESENTATION | CLAUS IBSEN
19. What is Apache Camel?
●
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");
}
19
}
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget)
.end();
PUBLIC PRESENTATION | CLAUS IBSEN
20. What is Apache Camel?
●
Camel Java DSL
import org.apache.camel.builder.RouteBuilder;
public class MyRoute extends RouteBuilder {
}
20
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();
}
PUBLIC PRESENTATION | CLAUS IBSEN
21. What is Apache Camel?
●
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>
21
PUBLIC PRESENTATION | CLAUS IBSEN
22. What is Apache Camel?
●
Endpoint as URIs
use file instead
<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>
22
PUBLIC PRESENTATION | CLAUS IBSEN
23. What is Apache Camel?
parameters
●
Endpoint as URIs
<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>
23
PUBLIC PRESENTATION | CLAUS IBSEN
24. What is Apache Camel?
●
24
Camel's Architecture
PUBLIC PRESENTATION | CLAUS IBSEN
25. What is Apache Camel?
120+ Components
25
PUBLIC PRESENTATION | CLAUS IBSEN
26. What is Apache Camel?
120+ Components
26
PUBLIC PRESENTATION | CLAUS IBSEN
27. What is Apache Camel?
●
Summary
●
●
Enterprise Integration Patterns (EIP)
●
Routing (using DSL)
●
Easy Configuration (endpoint as uri's)
●
No Container Dependency
●
27
Integration Framework
A lot of components
PUBLIC PRESENTATION | CLAUS IBSEN
28. Agenda
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
Hawtio – Camel Tooling
●
Q and A
28
PUBLIC PRESENTATION | CLAUS IBSEN
34. Agenda
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
Hawtio – Camel Tooling
●
Q and A
34
PUBLIC PRESENTATION | CLAUS IBSEN
38. Riding Camel
●
Twitter Example
●
cd examples/camel-example-twitter-websocket
●
mvn compile exec:java
38
http://localhost:9090/index.html
PUBLIC PRESENTATION | CLAUS IBSEN
39. Riding Camel
●
More examples ...
... and further details at website.
http://camel.apache.org/examples
39
PUBLIC PRESENTATION | CLAUS IBSEN
40. Agenda
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the box?
●
Deploying Camel
●
Creating new Camel Projects
●
Hawtio – Camel Tooling
●
Q and A
40
PUBLIC PRESENTATION | CLAUS IBSEN
41. What's in the box?
41
PUBLIC PRESENTATION | CLAUS IBSEN
42. What's in the box?
●
Enterprise Integration Patterns
http://camel.apache.org/eip
42
PUBLIC PRESENTATION | CLAUS IBSEN
43. What's in the box?
●
43
Splitter EIP
PUBLIC PRESENTATION | CLAUS IBSEN
44. What is Apache Camel?
120+ Components
44
PUBLIC PRESENTATION | CLAUS IBSEN
45. What is Apache Camel?
19 Data Formats
45
PUBLIC PRESENTATION | CLAUS IBSEN
46. What is Apache Camel?
15 Expression Languages
46
PUBLIC PRESENTATION | CLAUS IBSEN
47. What is Apache Camel?
5+ DSL in multiple languages
●
●
XML DSL (Spring and OSGi Blueprint)
●
Groovy DSL
●
Scala DSL
●
47
Java DSL
Kotlin DSL (work in progress)
PUBLIC PRESENTATION | CLAUS IBSEN
48. What is Apache Camel?
Test Kit
●
camel-test-spring
●
48
camel-test
camel-test-blueprint
camel-testng
PUBLIC PRESENTATION | CLAUS IBSEN
49. What is Apache Camel?
Management
●
●
49
JMX
REST (w/ Jolokia)
PUBLIC PRESENTATION | CLAUS IBSEN
50. What is Apache Camel?
Tooling – Web console - HawtIO
http://hawt.io
50
PUBLIC PRESENTATION | CLAUS IBSEN
51. What is Apache Camel?
Tooling – Eclipse Plugin – Fuse IDE
http://github.com/fusesource/fuseide
51
PUBLIC PRESENTATION | CLAUS IBSEN
52. What is Apache Camel?
Error Handling
52
PUBLIC PRESENTATION | CLAUS IBSEN
53. What is Apache Camel?
try .. catch style
53
PUBLIC PRESENTATION | CLAUS IBSEN
54. What is Apache Camel?
Dead Letter Channel (EIP style)
54
PUBLIC PRESENTATION | CLAUS IBSEN
55. Agenda
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
Hawtio – Camel Tooling
●
Q and A
55
PUBLIC PRESENTATION | CLAUS IBSEN
56. Deploying Camel
●
Deployment Strategy
●
●
●
No Container Dependency
Lightweight & Embeddable
Deployment Options
●
●
WAR
●
Spring
●
JEE
●
OSGi
●
56
Standalone
Cloud
PUBLIC PRESENTATION | CLAUS IBSEN
57. Camel as a Client
●
Java Client Application (no routes)
●
Example
●
57
Upload a file to a FTP server
PUBLIC PRESENTATION | CLAUS IBSEN
58. Agenda
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
Hawtio – Camel Tooling
●
Q and A
58
PUBLIC PRESENTATION | CLAUS IBSEN
59. Creating new Camel Projects
●
Using Command Shell
●
From Eclipse
59
PUBLIC PRESENTATION | CLAUS IBSEN
60. Creating new Camel Projects
●
60
Maven Archetypes
PUBLIC PRESENTATION | CLAUS IBSEN
61. Creating new Camel Projects
●
61
camel-archetype-blueprint
PUBLIC PRESENTATION | CLAUS IBSEN
62. Creating new Camel Projects
●
Importing into Eclipse
Existing Maven Project
62
PUBLIC PRESENTATION | CLAUS IBSEN
63. Agenda
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
Hawtio – Camel Tooling
●
Q and A
63
PUBLIC PRESENTATION | CLAUS IBSEN
65. Agenda
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
Hawtio – Camel Tooling
●
Q and A
65
PUBLIC PRESENTATION | CLAUS IBSEN
66. Where do I get more information?
●
Best Article covering what Apache Camel is
●
http://java.dzone.com/articles/open-source-integrationapache
Link to article from “Getting Started”
66
PUBLIC PRESENTATION | CLAUS IBSEN
67. Where do I get more information?
●
Try Camel Examples
●
●
Read other blogs and articles
●
●
67
http://camel.apache.org/examples.html
http://camel.apache.org/articles.html
Use the “search box” on the Camel front page
PUBLIC PRESENTATION | CLAUS IBSEN
68. Where do I get more information?
●
Use the mailing list / forum
●
●
Use stackoverflow
●
68
http://camel.apache.org/mailing-lists.html
http://stackoverflow.com/questions/tagged/apache-camel
PUBLIC PRESENTATION | CLAUS IBSEN
69. Where do I get more information?
●
Buy the Camel in Action book
Use code ...
camel40
… for 40% discount
http://manning.com/ibsen/
69
PUBLIC PRESENTATION | CLAUS IBSEN