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 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.
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Getting started with Apache Camel presentation at BarcelonaJUG, january 2014
1. Getting Started with Apache Camel.
Presentation and Workshop at
BarcelonaJUG, January 2014
Claus Ibsen (@davsclaus)
Principal Software Engineer, Red Hat
1
PUBLIC PRESENTATION | CLAUS IBSEN
2. Agenda
●
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
What's not in the Camel box?
●
2
History of Camel
More Information
PUBLIC PRESENTATION | CLAUS IBSEN
3. Your Speaker
●
Principal Software Engineer at Red Hat
●
Apache Camel
●
6 years working with Camel
●
Author of Camel in Action book
●
Contact
●
●
Twitter: @davsclaus
●
Blog: http://davsclaus.com
●
3
EMail: cibsen@redhat.com
Linkedin: http://www.linkedin.com/in/davsclaus
PUBLIC PRESENTATION | CLAUS IBSEN
4. Why the name Camel?
4
PUBLIC PRESENTATION | CLAUS IBSEN
5. Why the name Camel?
Because Camel is
easy to remember and type ...
5
PUBLIC PRESENTATION | CLAUS IBSEN
6. Why the name Camel?
… or the creator used to smoke cigarets!
http://camel.apache.org/why-the-name-camel.html
6
PUBLIC PRESENTATION | CLAUS IBSEN
9. The birth of Camel
●
9
First Commit
PUBLIC PRESENTATION | CLAUS IBSEN
10. The birth of Camel
●
10
My first Commit
PUBLIC PRESENTATION | CLAUS IBSEN
11. The birth of Camel
●
First Release
●
Apache Camel 1.0
June 2007
http://www.davsclaus.com/2012/05/looking-at-impressive-first-apache.html
11
PUBLIC PRESENTATION | CLAUS IBSEN
12. Agenda
●
History of Camel
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
What's not in the Camel box?
●
More Information
12
PUBLIC PRESENTATION | CLAUS IBSEN
13. What is Apache Camel?
●
13
Quote from the website
PUBLIC PRESENTATION | CLAUS IBSEN
14. What is Apache Camel?
●
Why do we need integration?
●
●
Critical for your business to integrate
Why Integration Framework?
●
●
You can focus on business problem
●
14
Framework do the heavy lifting
Not "reinventing the wheel"
PUBLIC PRESENTATION | CLAUS IBSEN
15. What is Apache Camel?
●
What is Enterprise Integration Patterns?
It's a book
15
PUBLIC PRESENTATION | CLAUS IBSEN
16. What is Apache Camel?
●
Enterprise Integration Patterns
http://camel.apache.org/eip
16
PUBLIC PRESENTATION | CLAUS IBSEN
17. What is Apache Camel?
●
17
EIP - Content Based Router
PUBLIC PRESENTATION | CLAUS IBSEN
18. What is Apache Camel?
from newOrder
18
PUBLIC PRESENTATION | CLAUS IBSEN
19. What is Apache Camel?
from newOrder
choice
19
PUBLIC PRESENTATION | CLAUS IBSEN
20. What is Apache Camel?
from newOrder
choice
when isWidget to widget
20
PUBLIC PRESENTATION | CLAUS IBSEN
21. What is Apache Camel?
from newOrder
choice
when isWidget to widget
otherwise to gadget
21
PUBLIC PRESENTATION | CLAUS IBSEN
22. What is Apache Camel?
from(newOrder)
choice
when(isWidget) to(widget)
otherwise to(gadget)
22
PUBLIC PRESENTATION | CLAUS IBSEN
23. What is Apache Camel?
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget);
23
PUBLIC PRESENTATION | CLAUS IBSEN
24. What is Apache Camel?
Endpoint newOrder = endpoint("activemq:queue:newOrder");
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget);
24
PUBLIC PRESENTATION | CLAUS IBSEN
25. 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);
25
PUBLIC PRESENTATION | CLAUS IBSEN
28. 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");
from(newOrder)
.choice()
.when(isWidget).to(widget)
.otherwise().to(gadget)
.end();
}
}
28
PUBLIC PRESENTATION | CLAUS IBSEN
29. What is Apache Camel?
●
Camel Java DSL
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();
}
}
29
PUBLIC PRESENTATION | CLAUS IBSEN
30. 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>
30
PUBLIC PRESENTATION | CLAUS IBSEN
31. 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>
31
PUBLIC PRESENTATION | CLAUS IBSEN
32. 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>
32
PUBLIC PRESENTATION | CLAUS IBSEN
33. Standard Java or XML
●
33
Java DSL is just Java
PUBLIC PRESENTATION | CLAUS IBSEN
34. Standard Java or XML
●
XML DSL is just XML
●
34
… with XSD schema for validation/tooling
PUBLIC PRESENTATION | CLAUS IBSEN
35. What is Apache Camel?
●
35
Camel's Architecture
PUBLIC PRESENTATION | CLAUS IBSEN
36. What is Apache Camel?
150+ Components
36
PUBLIC PRESENTATION | CLAUS IBSEN
37. What is Apache Camel?
150+ Components
37
PUBLIC PRESENTATION | CLAUS IBSEN
38. What is Apache Camel?
●
Summary
●
●
Enterprise Integration Patterns (EIP)
●
Routing (using DSL)
●
Easy Configuration (endpoint as uri's)
●
Just Java or XML code
●
No Container Dependency
●
38
Integration Framework
A lot of components
PUBLIC PRESENTATION | CLAUS IBSEN
39. Agenda
●
History of Camel
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
What's not in the Camel box?
●
More Information
39
PUBLIC PRESENTATION | CLAUS IBSEN
45. Agenda
●
History of Camel
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
What's not in the Camel box?
●
More Information
45
PUBLIC PRESENTATION | CLAUS IBSEN
49. Riding Camel
●
Twitter Example
●
cd examples/camel-example-twitter-websocket
●
mvn compile exec:java
49
http://localhost:9090/index.html
PUBLIC PRESENTATION | CLAUS IBSEN
50. Riding Camel
●
More examples ...
... and further details at website.
http://camel.apache.org/examples
50
PUBLIC PRESENTATION | CLAUS IBSEN
51. Agenda
●
History of Camel
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the box?
●
Deploying Camel
●
Creating new Camel Projects
●
What's not in the Camel box?
●
More Information
51
PUBLIC PRESENTATION | CLAUS IBSEN
52. What's in the box?
52
PUBLIC PRESENTATION | CLAUS IBSEN
53. What's in the box?
●
Enterprise Integration Patterns
http://camel.apache.org/eip
53
PUBLIC PRESENTATION | CLAUS IBSEN
54. What's in the box?
●
54
Pipes and Filters EIP
PUBLIC PRESENTATION | CLAUS IBSEN
55. What's in the box?
●
55
Pipes and Filters EIP
PUBLIC PRESENTATION | CLAUS IBSEN
56. What's in the box?
●
56
Recipient List EIP
PUBLIC PRESENTATION | CLAUS IBSEN
57. What's in the box?
●
57
Recipient List EIP
PUBLIC PRESENTATION | CLAUS IBSEN
58. What's in the box?
●
58
Splitter EIP
PUBLIC PRESENTATION | CLAUS IBSEN
59. What's in the box?
150+ Components
59
PUBLIC PRESENTATION | CLAUS IBSEN
60. What's in the box?
19 Data Formats
60
PUBLIC PRESENTATION | CLAUS IBSEN
61. What's in the box?
15 Expression Languages
61
PUBLIC PRESENTATION | CLAUS IBSEN
62. What's in the box?
5+ DSL in multiple languages
●
●
XML DSL (Spring and OSGi Blueprint)
●
Groovy DSL
●
Scala DSL
●
62
Java DSL
Kotlin DSL (work in progress)
PUBLIC PRESENTATION | CLAUS IBSEN
63. What's in the box?
●
Mixing Java and XML
●
●
63
Java DSL
Spring XML file
PUBLIC PRESENTATION | CLAUS IBSEN
64. What's in the box?
●
Mixing Java and XML
●
.. having both XML and Java routes
Java route
XML route
64
PUBLIC PRESENTATION | CLAUS IBSEN
65. What's in the box?
●
Multiple XML files
myCoolRoutes.xml
myOtherCoolRoutes.xml
myCamel.xml
65
PUBLIC PRESENTATION | CLAUS IBSEN
66. What's in the box?
●
Scanning on classpath for Java routes
●
●
66
… with packageScan
… supports excludes/includes
PUBLIC PRESENTATION | CLAUS IBSEN
67. What's in the box?
●
Scanning Spring ApplicationContext for Java routes
●
67
… with <contextScan/>
PUBLIC PRESENTATION | CLAUS IBSEN
68. What's in the box?
●
Scanning Spring ApplicationContext for Java routes
●
68
… and routes uses @Component
PUBLIC PRESENTATION | CLAUS IBSEN
69. What's in the box?
●
69
Type Converters
PUBLIC PRESENTATION | CLAUS IBSEN
70. What's in the box?
●
70
Writing Custom Type Converter
PUBLIC PRESENTATION | CLAUS IBSEN
71. What's in the box?
●
71
Bean as Message Translator
PUBLIC PRESENTATION | CLAUS IBSEN
72. What's in the box?
●
72
Bean as Message Translator
PUBLIC PRESENTATION | CLAUS IBSEN
73. What's in the box?
●
73
Working with beans
PUBLIC PRESENTATION | CLAUS IBSEN
74. What's in the box?
●
74
Working with beans
PUBLIC PRESENTATION | CLAUS IBSEN
75. What's in the box?
●
75
Working with beans
PUBLIC PRESENTATION | CLAUS IBSEN
76. What's in the box?
●
76
Working with beans
PUBLIC PRESENTATION | CLAUS IBSEN
77. What's in the box?
Test Kit
●
camel-test-spring
●
77
camel-test
camel-test-blueprint
camel-testng
PUBLIC PRESENTATION | CLAUS IBSEN
78. What's in the box?
Management
●
●
78
JMX
REST (w/ Jolokia)
PUBLIC PRESENTATION | CLAUS IBSEN
79. What's in the box?
Error Handling
79
PUBLIC PRESENTATION | CLAUS IBSEN
80. What's in the box?
try .. catch style
80
PUBLIC PRESENTATION | CLAUS IBSEN
81. What's in the box?
Dead Letter Channel (EIP style)
81
PUBLIC PRESENTATION | CLAUS IBSEN
82. What's in the box?
Dead Letter Channel (EIP style)
82
PUBLIC PRESENTATION | CLAUS IBSEN
83. What's in the box?
The Rest
●
Interceptors
●
Security
●
Route Policy
●
Type Converters
●
Transaction
●
Compensation as rollback
●
●
Thread management
●
Maven Tooling
●
83
Asynchronous non-blocking routing engine
... and much more
PUBLIC PRESENTATION | CLAUS IBSEN
84. Agenda
●
History of Camel
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
What's not in the Camel box?
●
More Information
84
PUBLIC PRESENTATION | CLAUS IBSEN
85. Deploying Camel
●
Deployment Strategy
●
●
●
No Container Dependency
Lightweight & Embeddable
Deployment Options
●
●
WAR
●
Spring
●
JEE
●
OSGi
●
85
Standalone
Cloud
PUBLIC PRESENTATION | CLAUS IBSEN
86. Camel as a Client
●
Java Client Application (no routes)
●
Example
●
86
Upload a file to a FTP server
PUBLIC PRESENTATION | CLAUS IBSEN
87. Agenda
●
History of Camel
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
What's not in the Camel box?
●
More Information
87
PUBLIC PRESENTATION | CLAUS IBSEN
88. Creating new Camel Projects
●
Using Command Shell
●
From Eclipse
88
PUBLIC PRESENTATION | CLAUS IBSEN
89. Creating new Camel Projects
●
89
Maven Archetypes
PUBLIC PRESENTATION | CLAUS IBSEN
90. Creating new Camel Projects
●
90
camel-archetype-blueprint
PUBLIC PRESENTATION | CLAUS IBSEN
91. Creating new Camel Projects
●
Importing into Eclipse
Existing Maven Project
91
PUBLIC PRESENTATION | CLAUS IBSEN
92. Creating new Camel Projects
●
Testing Camel Projects
●
... from inside Eclipse
92
PUBLIC PRESENTATION | CLAUS IBSEN
93. Agenda
●
History of Camel
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
What's not in the Camel box?
●
More Information
93
PUBLIC PRESENTATION | CLAUS IBSEN
94. What's not in the Camel box?
●
3rd party Apache Camel software
●
Commercial Support
●
●
User Stories
●
●
http://camel.apache.org/user-stories.html
External Components
●
●
http://camel.apache.org/commercial-camel-offerings.html
http://camel.apache.org/components.html (bottom)
Apache Camel Extra
●
94
https://code.google.com/a/apache-extras.org/p/camel-extra
PUBLIC PRESENTATION | CLAUS IBSEN
95. What's not in the Camel box?
Tooling – Eclipse Plugin – Fuse IDE
http://github.com/fusesource/fuseide
95
PUBLIC PRESENTATION | CLAUS IBSEN
96. What's not in the Camel box?
Tooling – Web console - HawtIO
http://hawt.io
96
PUBLIC PRESENTATION | CLAUS IBSEN
97. What's not in the Camel box?
●
Integration Platform
http://fabric8.io
97
PUBLIC PRESENTATION | CLAUS IBSEN
98. Agenda
●
History of Camel
●
What is Apache Camel?
●
A little Example
●
Riding Camel
●
What's in the Camel box?
●
Deploying Camel
●
Creating new Camel Projects
●
What's not in the Camel box?
●
More Information
98
PUBLIC PRESENTATION | CLAUS IBSEN
99. 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”
99
PUBLIC PRESENTATION | CLAUS IBSEN
100. Where do I get more information?
●
Try Camel Examples
●
●
Read other blogs and articles
●
●
100
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
101. Where do I get more information?
●
Use the mailing list / forum
●
●
Use stackoverflow
●
●
http://stackoverflow.com/questions/tagged/apache-camel
Use IRC chat
●
101
http://camel.apache.org/mailing-lists.html
http://camel.apache.org/irc-room.html
PUBLIC PRESENTATION | CLAUS IBSEN
102. Where do I get more information?
●
Buy the Camel in Action book
Use code ...
camel40
… for 40% discount
http://manning.com/ibsen/
102
PUBLIC PRESENTATION | CLAUS IBSEN
103. Where do I get more information?
●
.. and/or any of the other Camel books in the market
http://camel.apache.org/books
103
PUBLIC PRESENTATION | CLAUS IBSEN
104. Where do I get more information?
●
Attend the CamelOne conferences
The conference formerly known as CamelOne,
is now part of larger conference named DevNation
http://www.devnation.org
104
PUBLIC PRESENTATION | CLAUS IBSEN