Getting started with Apache Camel - May 2013
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Getting started with Apache Camel - May 2013

  • 2,353 views
Uploaded on

This session will teach you how to get a good start with Apache Camel. ...

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 a new project 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.

Before opening up for QA, we will share useful links where you can dive into learning more about Camel.

This presentation was video taped which you can find here: http://javagruppen.dk/index.php/moder/historiske-moder/285-javagruppemode-115-apache-camel-i-aarhus

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,353
On Slideshare
2,353
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
120
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. PUBLIC PRESENTATION | CLAUS IBSEN1Getting Started with Apache CamelClaus Ibsen (@davsclaus)Principal Software Engineer, Red HatJavagruppen Århus, may 2013
  • 2. PUBLIC PRESENTATION | CLAUS IBSEN2Agenda● History of Camel● What is Apache Camel?● A little Example● Riding Camel● Whats in the Camel box?● Deploying Camel● Creating new Camel Projects● Q and A
  • 3. PUBLIC PRESENTATION | CLAUS IBSEN3Your Speaker● Principal Software Engineer at Red Hat● Apache Camel● 5 years working with Camel● 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. PUBLIC PRESENTATION | CLAUS IBSEN4Why the name Camel?
  • 5. PUBLIC PRESENTATION | CLAUS IBSEN5Why the name Camel?Because Camel iseasy to remember and type ...
  • 6. PUBLIC PRESENTATION | CLAUS IBSEN6Why the name Camel?… or the creator used to smoke cigarets!http://camel.apache.org/why-the-name-camel.html
  • 7. PUBLIC PRESENTATION | CLAUS IBSEN7Camels parents
  • 8. PUBLIC PRESENTATION | CLAUS IBSEN8Camels parentsJames Strachan (creator of Camel)Gregor Hohpe (author of EIP book)
  • 9. PUBLIC PRESENTATION | CLAUS IBSEN9The birth of Camel● First Commit
  • 10. PUBLIC PRESENTATION | CLAUS IBSEN10The birth of Camel● My first Commit
  • 11. PUBLIC PRESENTATION | CLAUS IBSEN11The birth of Camel● First Release● Apache Camel 1.0June 2007http://www.davsclaus.com/2012/05/looking-at-impressive-first-apache.html
  • 12. PUBLIC PRESENTATION | CLAUS IBSEN12Agenda● History of Camel● What is Apache Camel?● A little Example● Riding Camel● Whats in the Camel box?● Deploying Camel● Creating new Camel Projects● Q and A
  • 13. PUBLIC PRESENTATION | CLAUS IBSEN13What is Apache Camel?● Quote from the website
  • 14. PUBLIC PRESENTATION | CLAUS IBSEN14What 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. PUBLIC PRESENTATION | CLAUS IBSEN15What is Apache Camel?● What is Enterprise Integration Patterns?Its a book
  • 16. PUBLIC PRESENTATION | CLAUS IBSEN16What is Apache Camel?● Enterprise Integration Patternshttp://camel.apache.org/eip
  • 17. PUBLIC PRESENTATION | CLAUS IBSEN17What is Apache Camel?● EIP - Content Based Router
  • 18. PUBLIC PRESENTATION | CLAUS IBSEN18What is Apache Camel?from newOrder
  • 19. PUBLIC PRESENTATION | CLAUS IBSEN19What is Apache Camel?from newOrderchoice
  • 20. PUBLIC PRESENTATION | CLAUS IBSEN20What is Apache Camel?from newOrderchoicewhen isWidget to widget
  • 21. PUBLIC PRESENTATION | CLAUS IBSEN21What is Apache Camel?from newOrderchoicewhen isWidget to widgetotherwise to gadget
  • 22. PUBLIC PRESENTATION | CLAUS IBSEN22What is Apache Camel?from(newOrder)choicewhen(isWidget) to(widget)otherwise to(gadget)
  • 23. PUBLIC PRESENTATION | CLAUS IBSEN23What is Apache Camel?from(newOrder).choice().when(isWidget).to(widget).otherwise().to(gadget);
  • 24. PUBLIC PRESENTATION | CLAUS IBSEN24What is Apache Camel?Endpoint newOrder = endpoint("activemq:queue:newOrder");from(newOrder).choice().when(isWidget).to(widget).otherwise().to(gadget);
  • 25. PUBLIC PRESENTATION | CLAUS IBSEN25What 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);
  • 26. PUBLIC PRESENTATION | CLAUS IBSEN26What 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);
  • 27. PUBLIC PRESENTATION | CLAUS IBSEN27What is Apache Camel?● Java Codepublic 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 IBSEN28What is Apache Camel?● Java Codeimport 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();}}
  • 29. PUBLIC PRESENTATION | CLAUS IBSEN29What is Apache Camel?● Camel Java DSLimport 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();}}
  • 30. PUBLIC PRESENTATION | CLAUS IBSEN30What 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>
  • 31. PUBLIC PRESENTATION | CLAUS IBSEN31What 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
  • 32. PUBLIC PRESENTATION | CLAUS IBSEN32What 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
  • 33. PUBLIC PRESENTATION | CLAUS IBSEN33What is Apache Camel?● Camels Architecture
  • 34. PUBLIC PRESENTATION | CLAUS IBSEN34What is Apache Camel?120+ Components
  • 35. PUBLIC PRESENTATION | CLAUS IBSEN35What is Apache Camel?120+ Components
  • 36. PUBLIC PRESENTATION | CLAUS IBSEN36What is Apache Camel?● Summary● Integration Framework● Enterprise Integration Patterns (EIP)● Routing (using DSL)● Easy Configuration (endpoint as uris)● Payload Agnostic● No Container Dependency● A lot of components
  • 37. PUBLIC PRESENTATION | CLAUS IBSEN37Agenda● History of Camel● What is Apache Camel?● A little Example● Riding Camel● Whats in the Camel box?● Deploying Camel● Creating new Camel Projects● Extending Camel● Q and A
  • 38. PUBLIC PRESENTATION | CLAUS IBSEN38A Little Example● File Copier Example
  • 39. PUBLIC PRESENTATION | CLAUS IBSEN39A Little Example● File Copier Example
  • 40. PUBLIC PRESENTATION | CLAUS IBSEN40A Little Example● File Copier Example
  • 41. PUBLIC PRESENTATION | CLAUS IBSEN41A Little Example● File Copier Example
  • 42. PUBLIC PRESENTATION | CLAUS IBSEN42A Little Example● File Copier Example
  • 43. PUBLIC PRESENTATION | CLAUS IBSEN43Agenda● History of Camel● What is Apache Camel?● A little Example● Riding Camel● Whats in the Camel box?● Deploying Camel● Creating new Camel Projects● Q and A
  • 44. PUBLIC PRESENTATION | CLAUS IBSEN44Riding Camel● Downloading Apache Camel● zip/tarball (approx 14mb)http://camel.apache.org
  • 45. PUBLIC PRESENTATION | CLAUS IBSEN45Riding Camel● Using Command Shell● Requires: Apache Maven● From Eclipse
  • 46. PUBLIC PRESENTATION | CLAUS IBSEN46Riding Camel● Console Example● cd examples/camel-example-console● mvn compile exec:java
  • 47. PUBLIC PRESENTATION | CLAUS IBSEN47Riding Camel● Twitter Example● cd examples/camel-example-twitter-websocket● mvn compile exec:java http://localhost:9090/index.html
  • 48. PUBLIC PRESENTATION | CLAUS IBSEN48Riding Camel● More examples ...... and further details at website.http://camel.apache.org/examples
  • 49. PUBLIC PRESENTATION | CLAUS IBSEN49Agenda● History of Camel● What is Apache Camel?● A little Example● Riding Camel● Whats in the box?● Deploying Camel● Creating new Camel Projects● Q and A
  • 50. PUBLIC PRESENTATION | CLAUS IBSEN50Whats in the box?
  • 51. PUBLIC PRESENTATION | CLAUS IBSEN51Whats in the box?● Enterprise Integration Patternshttp://camel.apache.org/eip
  • 52. PUBLIC PRESENTATION | CLAUS IBSEN52Whats in the box?● Pipes and Filters EIP
  • 53. PUBLIC PRESENTATION | CLAUS IBSEN53Whats in the box?● Pipes and Filters EIP
  • 54. PUBLIC PRESENTATION | CLAUS IBSEN54Whats in the box?● Recipient List EIP
  • 55. PUBLIC PRESENTATION | CLAUS IBSEN55Whats in the box?● Recipient List EIP
  • 56. PUBLIC PRESENTATION | CLAUS IBSEN56Whats in the box?● Splitter EIP
  • 57. PUBLIC PRESENTATION | CLAUS IBSEN57Whats in the box?120+ Components
  • 58. PUBLIC PRESENTATION | CLAUS IBSEN58Whats in the box?19 Data Formats
  • 59. PUBLIC PRESENTATION | CLAUS IBSEN59Whats in the box?15 Expression Languages
  • 60. PUBLIC PRESENTATION | CLAUS IBSEN60Whats in the box?5+ DSL in multiple languages● Java DSL● XML DSL (Spring and OSGi Blueprint)● Groovy DSL● Scala DSL● Kotlin DSL (work in progress)
  • 61. PUBLIC PRESENTATION | CLAUS IBSEN61Whats in the box?● Type Converters
  • 62. PUBLIC PRESENTATION | CLAUS IBSEN62Whats in the box?● Writing Custom Type Converter
  • 63. PUBLIC PRESENTATION | CLAUS IBSEN63Whats in the box?● Bean as Message Translator
  • 64. PUBLIC PRESENTATION | CLAUS IBSEN64Whats in the box?● Bean as Message Translator
  • 65. PUBLIC PRESENTATION | CLAUS IBSEN65Whats in the box?● Working with beans
  • 66. PUBLIC PRESENTATION | CLAUS IBSEN66Whats in the box?● Working with beans
  • 67. PUBLIC PRESENTATION | CLAUS IBSEN67Whats in the box?● Working with beans
  • 68. PUBLIC PRESENTATION | CLAUS IBSEN68Whats in the box?● Working with beans
  • 69. PUBLIC PRESENTATION | CLAUS IBSEN69Whats in the box?Test Kit● camel-test camel-test-spring● camel-test-blueprint camel-testng
  • 70. PUBLIC PRESENTATION | CLAUS IBSEN70Whats in the box?Management● JMX● REST(@deprecated)
  • 71. PUBLIC PRESENTATION | CLAUS IBSEN71Whats in the box?Tooling – Web console - HawtIOhttp://hawt.io
  • 72. PUBLIC PRESENTATION | CLAUS IBSEN72Whats in the box?Tooling – Eclipse Plugin – Fuse IDEhttp://github.com/fusesource/fuseide
  • 73. PUBLIC PRESENTATION | CLAUS IBSEN73Whats in the box?Error Handling
  • 74. PUBLIC PRESENTATION | CLAUS IBSEN74Whats in the box?try .. catch style
  • 75. PUBLIC PRESENTATION | CLAUS IBSEN75Whats in the box?Dead Letter Channel (EIP style)
  • 76. PUBLIC PRESENTATION | CLAUS IBSEN76Whats in the box?Dead Letter Channel (EIP style)
  • 77. PUBLIC PRESENTATION | CLAUS IBSEN77Whats in the box?The Rest● Interceptors● Security● Route Policy● Type Converters● Transaction● Compensation as rollback● Asynchronous non-blocking routing engine● Thread management● Maven Tooling● ... and much more
  • 78. PUBLIC PRESENTATION | CLAUS IBSEN78Agenda● History of Camel● What is Apache Camel?● A little Example● Riding Camel● Whats in the Camel box?● Deploying Camel● Creating new Camel Projects● Extending Camel● Q and A
  • 79. PUBLIC PRESENTATION | CLAUS IBSEN79Deploying Camel● Deployment Strategy● No Container Dependency● Lightweight & Embeddable● Deployment Options● Standalone● WAR● Spring● JEE● OSGi● Cloud
  • 80. PUBLIC PRESENTATION | CLAUS IBSEN80Camel as a Client● Java Client Application (no routes)● Example● Upload a file to a FTP server
  • 81. PUBLIC PRESENTATION | CLAUS IBSEN81Agenda● History of Camel● What is Apache Camel?● A little Example● Riding Camel● Whats in the Camel box?● Deploying Camel● Creating new Camel Projects● Q and A
  • 82. PUBLIC PRESENTATION | CLAUS IBSEN82Creating new Camel Projects● Using Command Shell● From Eclipse
  • 83. PUBLIC PRESENTATION | CLAUS IBSEN83Creating new Camel Projects● Maven Archetypes
  • 84. PUBLIC PRESENTATION | CLAUS IBSEN84Creating new Camel Projects● camel-archetype-blueprint
  • 85. PUBLIC PRESENTATION | CLAUS IBSEN85Creating new Camel Projects● Importing into EclipseExisting Maven Project
  • 86. PUBLIC PRESENTATION | CLAUS IBSEN86Creating new Camel Projects● Testing Camel Projects● ... from inside Eclipse
  • 87. PUBLIC PRESENTATION | CLAUS IBSEN87Agenda● History of Camel● What is Apache Camel?● A little Example● Riding Camel● Whats in the Camel box?● Deploying Camel● Creating new Camel Projects● Q and A
  • 88. PUBLIC PRESENTATION | CLAUS IBSEN88Where do I get more information?● Best Article covering what Apache Camel is● http://java.dzone.com/articles/open-source-integration-apacheLink to article from “Getting Started”
  • 89. PUBLIC PRESENTATION | CLAUS IBSEN89Where 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
  • 90. PUBLIC PRESENTATION | CLAUS IBSEN90Where 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
  • 91. PUBLIC PRESENTATION | CLAUS IBSEN91Where do I get more information?● Buy the Camel in Action bookhttp://manning.com/ibsen/Use code ...camel40… for 40% discount
  • 92. PUBLIC PRESENTATION | CLAUS IBSEN92Any Questions ?● Contact● EMail: cibsen@redhat.com● Twitter: @davsclaus● Blog: http://davsclaus.com● Linkedin: http://www.linkedin.com/in/davsclaus