Getting started with Apache Camel Claus Ibsen @davsclaus
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? ● More Information
3 Your Speaker ● Principal Software Engineer at Red Hat ● Apache Camel ● 6 years as committer ● Author of Camel in Action book ● Contact ● EMail: cibsen@redhat.com ● Twitter: @davsclaus ● Blog: http://davsclaus.com ● Linkedin: http://www.linkedin.com/in/davsclaus
4 My Camel Story ● Starts 7 years ago ● Consultant working for Silverbullet ● POC in 2007/2008 ● Looking for ● open source ● Integration framework ● As replacement for aging Integration Platform ● Apache Camel was one of the candidates
5 My Camel Story ● Apache Camel 1.2 had missing parts ● .. so I had to add those missing parts
6 My Camel Story ● .. to turn Camel into the lovely Camel it could be back. ● It was a success as our 1st Apache Camel 1.x integration went into production end of 2008.
7 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? ● More Information
8 What is Apache Camel? ● Quote from the website
9 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"
10 What is Apache Camel? ● What is Enterprise Integration Patterns? It's a book
11 What is Apache Camel? ● Enterprise Integration Patterns http://camel.apache.org/eip
12 What is Apache Camel? ● EIP - Content Based Router
13 What is Apache Camel? from newOrder
14 What is Apache Camel? from newOrder choice
15 What is Apache Camel? from newOrder choice when isWidget to widget
16 What is Apache Camel? from newOrder choice when isWidget to widget otherwise to gadget
17 What is Apache Camel? from(newOrder) choice when(isWidget) to(widget) otherwise to(gadget)
18 What is Apache Camel? from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
19 What is Apache Camel? Endpoint newOrder = endpoint("activemq:queue:newOrder"); from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
20 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);
21 What is Apache Camel? 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);
22 What is Apache Camel? ● Java Code 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(); }
23 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(); } }
24 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(); } }
25 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>
26 What is Apache Camel? ● Endpoint as URIs <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
27 What is Apache Camel? ● 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> parameters
28 Standard Java or XML ● Java DSL is just Java
29 Standard Java or XML ● XML DSL is just XML ● … with XSD schema for validation/tooling
30 What is Apache Camel? ● Camel's Architecture
31 What is Apache Camel? 150+ Components
32 What is Apache Camel? 150+ Components
33 What is Apache Camel? ● Summary ● Integration Framework ● Enterprise Integration Patterns (EIP) ● Routing (using DSL) ● Easy Configuration (endpoint as uri's) ● Just Java or XML code ● No Container Dependency ● A lot of components
34 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? ● More Information
35 A Little Example ● File Copier Example
36 A Little Example ● File Copier Example
37 A Little Example ● File Copier Example
38 A Little Example ● File Copier Example
39 A Little Example ● File Copier Example
40 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? ● More Information
41 Riding Camel ● Downloading Apache Camel ● zip/tarball (approx 8mb) http://camel.apache.org
42 Riding Camel ● Using Command Shell ● Requires: Apache Maven ● From Eclipse
43 Riding Camel ● Console Example ● cd examples/camel-example-console ● mvn compile exec:java
44 Riding Camel ● Twitter Example ● cd examples/camel-example-twitter-websocket ● mvn compile exec:java http://localhost:9090/index.html
45 Riding Camel ● More examples ... ... and further details at website. http://camel.apache.org/examples
46 Agenda ● 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
47 What's in the box?
48 What's in the box? ● Enterprise Integration Patterns http://camel.apache.org/eip
49 What's in the box? ● Splitter EIP
50 What's in the box? 150+ Components
51 What's in the box? 19 Data Formats
52 What's in the box? 15 Expression Languages
53 What's in the box? 4 DSL in multiple languages ● Java DSL ● XML DSL (Spring and OSGi Blueprint) ● Groovy DSL ● Scala DSL
54 What's in the box? Test Kit ● camel-test camel-test-spring ● camel-test-blueprint camel-testng
55 What's in the box? Management ● JMX ● REST (w/ Jolokia)
56 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? ● More Information
57 Deploying Camel ● Deployment Strategy ● No Container Dependency ● Lightweight & Embeddable ● Deployment Options ● Standalone ● WAR ● Spring ● JEE ● OSGi ● Cloud Known Containers Apache ActiveMQ Apache Karaf Apache ServiceMix Apache Tomcat Fabric8 Glassfish JBoss AS / Wildfly JBoss Fuse JBoss Fuse Service Works Jetty WebLogic WebSphere Known Clouds Amazon EC2 Google App Engine OpenStack OpenShift … and many more
58 Camel as a Client ● Java Client Application (no routes) ● Example ● Upload a file to a FTP server
59 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? ● More Information
60 Creating new Camel Projects ● Using Command Shell ● .. or from Eclipse
61 Creating new Camel Projects ● Importing into Eclipse Existing Maven Project
62 Creating new Camel Projects ● Maven Archetypes camel-archetype-activemq camel-archetype-java camel-archetype-blueprint camel-archetype-scala camel-archetype-component camel-archetype-spring camel-archetype-dataformat camel-archetype-spring-dm camel-archetype-groovy camel-archetype-web
63 Creating new Camel Projects ● camel-archetype-spring mvn install mvn camel:run mvn io.hawt:hawtio-maven-plugin:1.3.1:spring
64 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? ● More Information
65 What's not in the Camel box? ● 3rd party Apache Camel software ● Commercial Support ● http://camel.apache.org/commercial-camel-offerings.html ● User Stories ● http://camel.apache.org/user-stories.html ● External Components ● http://camel.apache.org/components.html (bottom) ● Apache Camel Extra ● https://code.google.com/a/apache-extras.org/p/camel-extra
66 What's not in the Camel box? Tooling – Eclipse Plugin – Fuse IDE Free community and Red Hat supported versions at: http://tools.jboss.org/downloads/
67 What's not in the Camel box? Tooling – Web Console - hawtio http://hawt.io
68 What's not in the Camel box? ● Integration Platform - fabric8 http://fabric8.io
69 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? ● More Information
70 Where do I get more information? ● Best Article covering what Apache Camel is ● http://java.dzone.com/articles/open-source-integration- apache Link to article from “Getting Started”
71 Where do I get more information? ● Try Camel Examples ● http://camel.apache.org/examples.html ● Read other blogs and articles ● http://camel.apache.org/articles.html ● Use the “search box” on the Camel front page
72 Where do I get more information? ● Use the mailing list / forum ● http://camel.apache.org/mailing-lists.html ● Use stackoverflow ● http://stackoverflow.com/questions/tagged/apache-camel ● Use IRC chat ● http://camel.apache.org/irc-room.html
73 Where do I get more information? ● Buy the Camel in Action book http://manning.com/ibsen/ Use code ... camel40 … for 40% discount
74 Where do I get more information? ● .. and/or any of the other Camel books in the market http://camel.apache.org/books
75 Any Questions ? ● Contact ● EMail: cibsen@redhat.com / claus.ibsen@gmail.com ● Twitter: @davsclaus ● Blog: http://davsclaus.com ● Linkedin: http://www.linkedin.com/in/davsclaus

Getting Started with Apache Camel at DevNation 2014

  • 1.
    Getting started with ApacheCamel Claus Ibsen @davsclaus
  • 2.
    2 Agenda ● What isApache 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
  • 3.
    3 Your Speaker ● PrincipalSoftware Engineer at Red Hat ● Apache Camel ● 6 years as committer ● Author of Camel in Action book ● Contact ● EMail: cibsen@redhat.com ● Twitter: @davsclaus ● Blog: http://davsclaus.com ● Linkedin: http://www.linkedin.com/in/davsclaus
  • 4.
    4 My Camel Story ●Starts 7 years ago ● Consultant working for Silverbullet ● POC in 2007/2008 ● Looking for ● open source ● Integration framework ● As replacement for aging Integration Platform ● Apache Camel was one of the candidates
  • 5.
    5 My Camel Story ●Apache Camel 1.2 had missing parts ● .. so I had to add those missing parts
  • 6.
    6 My Camel Story ●.. to turn Camel into the lovely Camel it could be back. ● It was a success as our 1st Apache Camel 1.x integration went into production end of 2008.
  • 7.
    7 Agenda ● What isApache 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
  • 8.
    8 What is ApacheCamel? ● Quote from the website
  • 9.
    9 What is ApacheCamel? ● 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"
  • 10.
    10 What is ApacheCamel? ● What is Enterprise Integration Patterns? It's a book
  • 11.
    11 What is ApacheCamel? ● Enterprise Integration Patterns http://camel.apache.org/eip
  • 12.
    12 What is ApacheCamel? ● EIP - Content Based Router
  • 13.
    13 What is ApacheCamel? from newOrder
  • 14.
    14 What is ApacheCamel? from newOrder choice
  • 15.
    15 What is ApacheCamel? from newOrder choice when isWidget to widget
  • 16.
    16 What is ApacheCamel? from newOrder choice when isWidget to widget otherwise to gadget
  • 17.
    17 What is ApacheCamel? from(newOrder) choice when(isWidget) to(widget) otherwise to(gadget)
  • 18.
    18 What is ApacheCamel? from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
  • 19.
    19 What is ApacheCamel? Endpoint newOrder = endpoint("activemq:queue:newOrder"); from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
  • 20.
    20 What is ApacheCamel? Endpoint newOrder = endpoint("activemq:queue:newOrder"); Predicate isWidget = xpath("/order/product = 'widget'"); from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
  • 21.
    21 What is ApacheCamel? 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);
  • 22.
    22 What is ApacheCamel? ● Java Code 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(); }
  • 23.
    23 What is ApacheCamel? ● 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(); } }
  • 24.
    24 What is ApacheCamel? ● 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(); } }
  • 25.
    25 What is ApacheCamel? ● 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>
  • 26.
    26 What is ApacheCamel? ● Endpoint as URIs <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
  • 27.
    27 What is ApacheCamel? ● 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> parameters
  • 28.
    28 Standard Java orXML ● Java DSL is just Java
  • 29.
    29 Standard Java orXML ● XML DSL is just XML ● … with XSD schema for validation/tooling
  • 30.
    30 What is ApacheCamel? ● Camel's Architecture
  • 31.
    31 What is ApacheCamel? 150+ Components
  • 32.
    32 What is ApacheCamel? 150+ Components
  • 33.
    33 What is ApacheCamel? ● Summary ● Integration Framework ● Enterprise Integration Patterns (EIP) ● Routing (using DSL) ● Easy Configuration (endpoint as uri's) ● Just Java or XML code ● No Container Dependency ● A lot of components
  • 34.
    34 Agenda ● What isApache 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
  • 35.
    35 A Little Example ●File Copier Example
  • 36.
    36 A Little Example ●File Copier Example
  • 37.
    37 A Little Example ●File Copier Example
  • 38.
    38 A Little Example ●File Copier Example
  • 39.
    39 A Little Example ●File Copier Example
  • 40.
    40 Agenda ● What isApache 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
  • 41.
    41 Riding Camel ● DownloadingApache Camel ● zip/tarball (approx 8mb) http://camel.apache.org
  • 42.
    42 Riding Camel ● UsingCommand Shell ● Requires: Apache Maven ● From Eclipse
  • 43.
    43 Riding Camel ● ConsoleExample ● cd examples/camel-example-console ● mvn compile exec:java
  • 44.
    44 Riding Camel ● TwitterExample ● cd examples/camel-example-twitter-websocket ● mvn compile exec:java http://localhost:9090/index.html
  • 45.
    45 Riding Camel ● Moreexamples ... ... and further details at website. http://camel.apache.org/examples
  • 46.
    46 Agenda ● What isApache 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
  • 47.
  • 48.
    48 What's in thebox? ● Enterprise Integration Patterns http://camel.apache.org/eip
  • 49.
    49 What's in thebox? ● Splitter EIP
  • 50.
    50 What's in thebox? 150+ Components
  • 51.
    51 What's in thebox? 19 Data Formats
  • 52.
    52 What's in thebox? 15 Expression Languages
  • 53.
    53 What's in thebox? 4 DSL in multiple languages ● Java DSL ● XML DSL (Spring and OSGi Blueprint) ● Groovy DSL ● Scala DSL
  • 54.
    54 What's in thebox? Test Kit ● camel-test camel-test-spring ● camel-test-blueprint camel-testng
  • 55.
    55 What's in thebox? Management ● JMX ● REST (w/ Jolokia)
  • 56.
    56 Agenda ● What isApache 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
  • 57.
    57 Deploying Camel ● DeploymentStrategy ● No Container Dependency ● Lightweight & Embeddable ● Deployment Options ● Standalone ● WAR ● Spring ● JEE ● OSGi ● Cloud Known Containers Apache ActiveMQ Apache Karaf Apache ServiceMix Apache Tomcat Fabric8 Glassfish JBoss AS / Wildfly JBoss Fuse JBoss Fuse Service Works Jetty WebLogic WebSphere Known Clouds Amazon EC2 Google App Engine OpenStack OpenShift … and many more
  • 58.
    58 Camel as aClient ● Java Client Application (no routes) ● Example ● Upload a file to a FTP server
  • 59.
    59 Agenda ● What isApache 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
  • 60.
    60 Creating new CamelProjects ● Using Command Shell ● .. or from Eclipse
  • 61.
    61 Creating new CamelProjects ● Importing into Eclipse Existing Maven Project
  • 62.
    62 Creating new CamelProjects ● Maven Archetypes camel-archetype-activemq camel-archetype-java camel-archetype-blueprint camel-archetype-scala camel-archetype-component camel-archetype-spring camel-archetype-dataformat camel-archetype-spring-dm camel-archetype-groovy camel-archetype-web
  • 63.
    63 Creating new CamelProjects ● camel-archetype-spring mvn install mvn camel:run mvn io.hawt:hawtio-maven-plugin:1.3.1:spring
  • 64.
    64 Agenda ● What isApache 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
  • 65.
    65 What's not inthe Camel box? ● 3rd party Apache Camel software ● Commercial Support ● http://camel.apache.org/commercial-camel-offerings.html ● User Stories ● http://camel.apache.org/user-stories.html ● External Components ● http://camel.apache.org/components.html (bottom) ● Apache Camel Extra ● https://code.google.com/a/apache-extras.org/p/camel-extra
  • 66.
    66 What's not inthe Camel box? Tooling – Eclipse Plugin – Fuse IDE Free community and Red Hat supported versions at: http://tools.jboss.org/downloads/
  • 67.
    67 What's not inthe Camel box? Tooling – Web Console - hawtio http://hawt.io
  • 68.
    68 What's not inthe Camel box? ● Integration Platform - fabric8 http://fabric8.io
  • 69.
    69 Agenda ● What isApache 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
  • 70.
    70 Where do Iget more information? ● Best Article covering what Apache Camel is ● http://java.dzone.com/articles/open-source-integration- apache Link to article from “Getting Started”
  • 71.
    71 Where do Iget more information? ● Try Camel Examples ● http://camel.apache.org/examples.html ● Read other blogs and articles ● http://camel.apache.org/articles.html ● Use the “search box” on the Camel front page
  • 72.
    72 Where do Iget more information? ● Use the mailing list / forum ● http://camel.apache.org/mailing-lists.html ● Use stackoverflow ● http://stackoverflow.com/questions/tagged/apache-camel ● Use IRC chat ● http://camel.apache.org/irc-room.html
  • 73.
    73 Where do Iget more information? ● Buy the Camel in Action book http://manning.com/ibsen/ Use code ... camel40 … for 40% discount
  • 74.
    74 Where do Iget more information? ● .. and/or any of the other Camel books in the market http://camel.apache.org/books
  • 75.
    75 Any Questions ? ●Contact ● EMail: cibsen@redhat.com / claus.ibsen@gmail.com ● Twitter: @davsclaus ● Blog: http://davsclaus.com ● Linkedin: http://www.linkedin.com/in/davsclaus