Getting Started with Apache Camel at DevNation 2014

2,489 views

Published on

Get off to a good start with Apache Camel. This session will give you an introduction to Apache Camel and teach you:

- How Camel is related to enterprise integration patterns (EIPs).
- How to use EIPs in Camel routes written in Java code or XML files.
- How to get started developing with Camel, including how to set up new projects from scratch using Maven and Eclipse.
- With a live demo, how to build Camel applications in Java, Spring, and OSGi Blueprint.
- How ready-to-use features make integration much easier.
- About the web console tools that give you insight into your running Apache Camel applications, including visual route diagrams with tracing, debugging, and profiling capabilities.
- Useful resources to learn more about Camel.

This session will be taught with a 50/50 mix of slides and live demos, and it will conclude with Q&A time.

Published in: Software, Technology, Education
1 Comment
8 Likes
Statistics
Notes
  • Pg 11 and Pg 30: What is the drastic different between Camel and FuseESB? It seems to me that it is just creating a bunch of JMS queue to replace the ESB which was suppose to consolidate various queues? Kindly explain. IBM-MQ, TIBCO and can do UI configuration to reroute EMS messages without much coding with distributed engines.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
2,489
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
158
Comments
1
Likes
8
Embeds 0
No embeds

No notes for slide

Getting Started with Apache Camel at DevNation 2014

  1. 1. Getting started with Apache Camel Claus Ibsen @davsclaus
  2. 2. 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. 3. 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. 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. 5 My Camel Story ● Apache Camel 1.2 had missing parts ● .. so I had to add those missing parts
  6. 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. 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. 8. 8 What is Apache Camel? ● Quote from the website
  9. 9. 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. 10. 10 What is Apache Camel? ● What is Enterprise Integration Patterns? It's a book
  11. 11. 11 What is Apache Camel? ● Enterprise Integration Patterns http://camel.apache.org/eip
  12. 12. 12 What is Apache Camel? ● EIP - Content Based Router
  13. 13. 13 What is Apache Camel? from newOrder
  14. 14. 14 What is Apache Camel? from newOrder choice
  15. 15. 15 What is Apache Camel? from newOrder choice when isWidget to widget
  16. 16. 16 What is Apache Camel? from newOrder choice when isWidget to widget otherwise to gadget
  17. 17. 17 What is Apache Camel? from(newOrder) choice when(isWidget) to(widget) otherwise to(gadget)
  18. 18. 18 What is Apache Camel? from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
  19. 19. 19 What is Apache Camel? Endpoint newOrder = endpoint("activemq:queue:newOrder"); from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
  20. 20. 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. 21. 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. 22. 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. 23. 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. 24. 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. 25. 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. 26. 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. 27. 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. 28. 28 Standard Java or XML ● Java DSL is just Java
  29. 29. 29 Standard Java or XML ● XML DSL is just XML ● … with XSD schema for validation/tooling
  30. 30. 30 What is Apache Camel? ● Camel's Architecture
  31. 31. 31 What is Apache Camel? 150+ Components
  32. 32. 32 What is Apache Camel? 150+ Components
  33. 33. 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. 34. 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. 35. 35 A Little Example ● File Copier Example
  36. 36. 36 A Little Example ● File Copier Example
  37. 37. 37 A Little Example ● File Copier Example
  38. 38. 38 A Little Example ● File Copier Example
  39. 39. 39 A Little Example ● File Copier Example
  40. 40. 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. 41. 41 Riding Camel ● Downloading Apache Camel ● zip/tarball (approx 8mb) http://camel.apache.org
  42. 42. 42 Riding Camel ● Using Command Shell ● Requires: Apache Maven ● From Eclipse
  43. 43. 43 Riding Camel ● Console Example ● cd examples/camel-example-console ● mvn compile exec:java
  44. 44. 44 Riding Camel ● Twitter Example ● cd examples/camel-example-twitter-websocket ● mvn compile exec:java http://localhost:9090/index.html
  45. 45. 45 Riding Camel ● More examples ... ... and further details at website. http://camel.apache.org/examples
  46. 46. 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. 47. 47 What's in the box?
  48. 48. 48 What's in the box? ● Enterprise Integration Patterns http://camel.apache.org/eip
  49. 49. 49 What's in the box? ● Splitter EIP
  50. 50. 50 What's in the box? 150+ Components
  51. 51. 51 What's in the box? 19 Data Formats
  52. 52. 52 What's in the box? 15 Expression Languages
  53. 53. 53 What's in the box? 4 DSL in multiple languages ● Java DSL ● XML DSL (Spring and OSGi Blueprint) ● Groovy DSL ● Scala DSL
  54. 54. 54 What's in the box? Test Kit ● camel-test camel-test-spring ● camel-test-blueprint camel-testng
  55. 55. 55 What's in the box? Management ● JMX ● REST (w/ Jolokia)
  56. 56. 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. 57. 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. 58. 58 Camel as a Client ● Java Client Application (no routes) ● Example ● Upload a file to a FTP server
  59. 59. 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. 60. 60 Creating new Camel Projects ● Using Command Shell ● .. or from Eclipse
  61. 61. 61 Creating new Camel Projects ● Importing into Eclipse Existing Maven Project
  62. 62. 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. 63. 63 Creating new Camel Projects ● camel-archetype-spring mvn install mvn camel:run mvn io.hawt:hawtio-maven-plugin:1.3.1:spring
  64. 64. 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. 65. 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. 66. 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. 67. 67 What's not in the Camel box? Tooling – Web Console - hawtio http://hawt.io
  68. 68. 68 What's not in the Camel box? ● Integration Platform - fabric8 http://fabric8.io
  69. 69. 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. 70. 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. 71. 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. 72. 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. 73. 73 Where do I get more information? ● Buy the Camel in Action book http://manning.com/ibsen/ Use code ... camel40 … for 40% discount
  74. 74. 74 Where do I get more information? ● .. and/or any of the other Camel books in the market http://camel.apache.org/books
  75. 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

×