Apache Camel - FUSE community day London 2010 presentation

4,979 views

Published on

My Apache Camel presentation from the FUSE community day event, London June 2010.

A video/audio/transcript of the presentation is in the works and will later be published at the fusesource (http://fusesource.com) website.

Published in: Technology

Apache Camel - FUSE community day London 2010 presentation

  1. 1. Apache Camel Claus Ibsen Principal Software Engineer, Progress Software June 2010 1 Tuesday, June 8, 2010
  2. 2. Agenda  Who is Claus Ibsen?  The birth of Apache Camel  What is Apache Camel  A little example  Whats included in the box?  Running Camel  The Camel Community  Where are we today?  Where are we going tomorrow?  Q and A 2 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  3. 3. Who is Claus Ibsen?  Principal Software Engineer at Progress Software • Full time Apache Camel hacker  Apache Camel committer for 2+ years • 30 months working with Camel  Co-author of Camel in Action book • Available in Q3 2010  Contact • cibsen@progress.com • claus.ibsen@gmail.com • http://davsclaus.blogspot.com/ • http://twitter.com/davsclaus 3 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  4. 4. Agenda  Who is Claus Ibsen?  The birth of Apache Camel  What is Apache Camel  A little example  Whats included in the box?  Running Camel  The Camel Community  Where are we today?  Where are we going tomorrow?  Q and A 4 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  5. 5. The birth of Apache Camel • Camel’s parents 5 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  6. 6. The birth of Apache Camel  Initial Commit Log r519901 | jstrachan | 2007-03-19 11:54:57 +0100 (Mon, 19 Mar 2007) | 1 line Initial checkin of Camel routing library  Apache Camel 1.0 released June 2007  Apache Camel is 3 years old 6 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  7. 7. The birth of Apache Camel 7 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  8. 8. The birth of Apache Camel  My initial commit r640963 | davsclaus | 2008-03-25 21:07:10 +0100 (Tue, 25 Mar 2008) | 1 line Added unit test for mistyped URI 8 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  9. 9. Agenda  Who is Claus Ibsen?  The birth of Apache Camel  What is Apache Camel  A little example  Whats included in the box?  Running Camel  The Camel Community  Where are we today?  Where are we going tomorrow?  Q and A 9 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  10. 10. What is Apache Camel  Quote from the web site Apache Camel is a Powerful Open Source Integration Framework based on known Enterprise Integration Patterns 10 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  11. 11. What is Apache Camel  What are Enterprise Integration Patterns? 11 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  12. 12. What is Apache Camel  What are Enterprise Integration Patterns? 12 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  13. 13. What is Apache Camel  What are Enterprise Integration Patterns? Its a book 13 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  14. 14. What is Apache Camel  Lets look at one of the patterns 14 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  15. 15. What is Apache Camel  Use Case ActiveMQ WebSphereMQ 15 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  16. 16. What is Apache Camel  Filter Pattern 16 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  17. 17. What is Apache Camel  Filter Pattern from filter send to A message B 17 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  18. 18. What is Apache Camel  Filter Pattern from(A) filter(predicate) to(B) 18 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  19. 19. What is Apache Camel  Filter Pattern from(A) .filter(isWidget) .to(B) 19 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  20. 20. What is Apache Camel  Filter Route from(A).filter(isWidget).to(B); 20 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  21. 21. What is Apache Camel  Filter Route isWidget = xpath(“/quote/product = ‘widget’”); from(A).filter(isWidget).to(B); 21 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  22. 22. What is Apache Camel  Filter Route Endpoint A = endpoint(“activemq:queue:quote”); Endpoint B = endpoint(“mq:quote”); Predicate isWidget = xpath(“/quote/product = ‘widget’”); from(A).filter(isWidget).to(B); 22 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  23. 23. What is Apache Camel  Filter Route - Java DSL public void configure() throws Exception { Endpoint A = endpoint("activemq:queue:quote"); Endpoint B = endpoint("mq:quote"); Predicate isWidget = xpath("/quote/product = ‘widget’"); from(A).filter(isWidget).to(B); } 23 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  24. 24. What is Apache Camel  Filter Route - Java DSL import org.apache.camel.builder.RouteBuilder; import static org.apache.camel.builder.xml.XPathBuilder.xpath; public class FilterRoute extends RouteBuilder { public void configure() throws Exception { Endpoint A = endpoint("activemq:queue:quote"); Endpoint B = endpoint("mq:quote"); Predicate isWidget = xpath("/quote/product = ‘widget’"); from(A).filter(isWidget).to(B); } } 24 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  25. 25. What is Apache Camel  Filter Route - Java DSL import org.apache.camel.builder.RouteBuilder; public class FilterRoute extends RouteBuilder { public void configure() throws Exception { from("activemq:queue:quote") .filter().xpath("/quote/product =‘widget’") .to("mq:quote"); } } 25 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  26. 26. What is Apache Camel  IDE Tooling Code Assistance JavaDoc 26 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  27. 27. What is Apache Camel  IDE Tooling Code Assistance 27 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  28. 28. What is Apache Camel  Recap - Concepts of Camel • Enterprise Integration Patterns • Routing • Domain Specific Language (DSL) • Endpoints • URIs • Predicates & Expressions • Components and much more ... Simplify Integration 28 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  29. 29. What is Apache Camel  Lets look at the most famous pattern 29 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  30. 30. What is Apache Camel  Content Based Router 30 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  31. 31. What is Apache Camel  Content Based Router - Spring XML <camelContext> <route> <from uri="activemq:NewOrders"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:Orders.Widgets"/> </when> <otherwise> <to uri="activemq:Orders.Gadgets"/> </otherwise> </choice> </route> </camelContext> 31 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  32. 32. What is Apache Camel  Content Based Router - Java DSL from("activemq:NewOrders") .choice() .when().xpath(“/order/product = 'widget'”) .to(“activemq:Orders.Widget”); .otherwise() .to(“acitvemq:Orders.Gadget”); 32 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  33. 33. Agenda  Who is Claus Ibsen?  The birth of Apache Camel  What is Apache Camel  A little example  Whats included in the box?  Running Camel  The Camel Community  Where are we today?  Where are we going tomorrow?  Q and A 33 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  34. 34. A little example  Based on community user (Gunnar Hillert) • http://hillert.blogspot.com/2009/09/camellos-discovering-apache- camel-ii.html  Goals • 1) Pickup files from a directory • 2) Make sure we only pickup 3 files per 30 seconds • 3) Store into JMS queue • 4) Listen on JMS queue • 5) And upload file to FTP server 34 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  35. 35. A little example  Goals using Enterprise Integration Patterns 1 2 3 4 5  Goals • 1) Pickup files from a directory • 2) Make sure we only pickup 3 files per 30 seconds • 3) Store into JMS queue • 4) Listen on JMS queue • 5) And upload file to FTP server 35 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  36. 36. A little example  Goals using Enterprise Integration Patterns from throttle to from to  Goals • 1) Pickup files from a directory • 2) Make sure we only pickup 3 files per 30 seconds • 3) Store into JMS queue • 4) Listen on JMS queue • 5) And upload file to FTP server 36 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  37. 37. A little example  Camel DSL in XML <camelContext> <route> <from uri="file:camellos/inbox?move=.done"/> <throttle maximumRequestsPerPeriod="3” timePeriodMillis="30000”> <to uri="activemq:queue:camellos"/> </throttle> </route> <route> <from uri="activemq:queue:camellos"/> <to uri="ftp://admin:secret@localhost:3333"/> </route> </camelContext> 37 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  38. 38. Agenda  Who is Claus Ibsen?  The birth of Apache Camel  What is Apache Camel  A little example  Whats included in the box?  Running Camel  The Camel Community  Where are we today?  Where are we going tomorrow?  Q and A 38 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  39. 39. Whats included in the box?  Highlights of whats included in Camel 39 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  40. 40. Whats included in the box?  70+ Components activemq crypto flatpack irc ldap activemq-journal cxf freemarker javaspace mail/imap/pop3 amqp cxfrs ftp/ftps/sftp jbi mina atom dataset gae jcr mock bean direct hdfs jdbc msv bean validation esper hibernate jetty nagios browse event hl7 jms netty cache exec http jpa nmr cometd file ibatis jt/400 printer http://camel.apache.org/components.html 40 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  41. 41. Whats included in the box?  70+ Components properties scalate stream xslt quartz seda string-template ejb quickfix servlet test ref smooks timer restlet smpp validation rmi snmp velocity rnc spring-integration vm rng spring-security xmpp rss sql xquery http://camel.apache.org/components.html 41 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  42. 42. Whats included in the box?  18 Data Formats bindy protobuf castor serialization csv soap crypto tidy markup flatpack xml beans gzip xml security hl7 xstream jaxb zip json dozer http://camel.apache.org/data-format.html 42 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  43. 43. Whats included in the box?  Data Format from("activemq:QueueWithJavaObjects”) .marshal().jaxb() .to("mq:QueueWithXmlMessages"); 43 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  44. 44. Whats included in the box?  Predicates & Expressions BeanShell PHP EL Python Groovy Ruby JavaScript Simple JSR 223 SQL OGNL XPath MVEL XQuery http://camel.apache.org/languages.html 44 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  45. 45. Whats included in the box?  DSL in 3 programming languages Java XML from(A).filter(isWidget).to(B); <route> <from ref="A"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to ref="B"/> </filter> </route> from(A) filter(isWidget) --> B Scala 45 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  46. 46. Whats included in the box?  Type Converters INFO DefaultTypeConverter - Loaded 148 type converters 46 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  47. 47. Whats included in the box?  Custom Type Converters @Converter public class MyTypeConverter { @Converter public String toString(MyOrder order) { StringBuilder sb = new StringBuilder(); ... return sb.toString(); } } # META-INF/services/org/apache/camel/TypeConverter com.acme.converters META-INF file in the JAR 47 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  48. 48. Whats included in the box?  Powerful bean integration • Adapt to your beans • EIP as @annotations - @Produce - @Consume - @RecipientList - @RoutingSlip more to come in future releases ... 48 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  49. 49. Whats included in the box?  Bean as Message Translator 49 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  50. 50. Whats included in the box?  Bean as Message Translator from("activemq:Incoming”). beanRef("myBeanName”, “someMethod"). to("activemq:Outgoing"); public class Foo { public String someMethod(String name) { return “Hello “ + name; } } 50 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  51. 51. Whats included in the box?  Bean Parameter Binding with XPath public class Foo { public String processOrder( String orderAsXml, @XPath(”/order/@id”) String oid, @Header(”JMSCorrelationID”) String cid) { ... } } 51 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  52. 52. Whats included in the box?  Bean Parameter Binding with Languages public class Foo { public void processOrder( MyOrder order, @Simple(”${body.customer.gold}”) boolean gold) { ... } } MyOrder - id Customer - customer - gold - street - zip 52 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  53. 53. Whats included in the box?  Sending message public class Foo { @Produce(uri="activemq:foo.bar") ProducerTemplate producer; public void doSomething() { if (whatever) { producer.sendBody("<hello>world!</hello>"); } } } 53 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  54. 54. Whats included in the box?  Sending message w/ interface public interface EchoService { String sayEcho(String echo); } 54 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  55. 55. Whats included in the box?  Sending message w/ interface public class Echo { @Produce(uri="http://somewhere/echo") EchoService echo; public void doTheEcho() { String reply = echo.sayEcho("Hi"); } } 55 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  56. 56. Whats included in the box?  Sending message w/ no Camel API <proxy id="echo" serviceInterface="com...EchoService" serviceUrl="http://somewhere/echo"/> public class Echo { @Autowired EchoService echo; public void doTheEcho() { String reply = echo.sayEcho("Hi"); } } 56 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  57. 57. Whats included in the box?  The EJB MessageDrivenBean in Camel public class Foo { @Consume(uri="activemq:cheese") public void onCheese(String name) { ... } } 57 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  58. 58. Whats included in the box?  Test Kit • JUnit based (3.x and 4.x) • Supports Spring • Easy to test • Quick prototyping 58 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  59. 59. Whats included in the box? extend CamelTestSupport  Test Kit from IDE Right Click -> Run Debug Inline RouteBuilder 59 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  60. 60. Whats included in the box?  Managed • JMX API • REST API 60 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  61. 61. Whats included in the box?  Web console • REST API 61 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  62. 62. Whats included in the box?  Maven tooling • Maven Archetypes to create new projects mvn archetype:generate -DarchetypeGroupId=org.apache.camel.archetypes -DarchetypeArtifactId=camel-archetype-war -DarchetypeVersion=2.3.0 • Maven goals to run project - mvn camel:run - mvn jetty:run 62 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  63. 63. Agenda  Who is Claus Ibsen?  The birth of Apache Camel  What is Apache Camel  A little example  Whats included in the box?  Running Camel  The Camel Community  Where are we today?  Where are we going tomorrow?  Q and A 63 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  64. 64. Running Camel  Riding the Camel 64 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  65. 65. Running Camel  Java Application CamelContext context = new DefaultCamelContext(); context.addRoutes(new MyRouteBuilder()); context.start();  Spring Application <camelContext> <package>com.acme.quotes</package> </camelContext> 65 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  66. 66. Running Camel  Lightweight  Embeddable  Known Deployment Options • Standalone Java Application Known Containers • Web Application Apache ServiceMix Apache ActiveMQ • J2EE Application Apache Tomcat • JBI Jetty • OSGi JBoss IBM WebSphere • Google App Engine BEA WebLogic • Java Web Start Oracle OC4j • Spring Application GAE ... others 66 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  67. 67. Agenda  Who is Claus Ibsen?  The birth of Apache Camel  What is Apache Camel  A little example  Whats included in the box?  Running Camel  The Camel Community  Where are we today?  Where are we going tomorrow?  Q and A 67 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  68. 68. The Camel Community  Camel website • 40% increase (comparing last two 6 month periods) • 2000-2500 visits per weekday  High activity on mailing list http://old.nabble.com/ 68 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  69. 69. The Camel Community  High activity on mailing list (cont.) http://markmail.org/ 69 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  70. 70. The Camel Community  20 committers  High commit activity http://markmail.org/ 70 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  71. 71. The Camel Community  JIRA tickets Total 2795 Open 154 (6%) Resolved 2641 (94%) Bugs 11 (7% open) Oldest Bug June/29/09 June 8th 2010 71 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  72. 72. The Camel Community  A lot in each new release Release Date Tickets Camel 2.0 Aug 2009 760 Camel 2.1 Dec 2009 303 Camel 2.2 Feb 2010 180 Camel 2.3 May 2010 273 72 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  73. 73. The Camel Community  Contributors • 6 new contributed components in Camel 2.3  Contributor --> Committer meritocracy 73 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  74. 74. The Camel Community  3rd party integrating Camel • Apache ServiceMix • Apache ActiveMQ • Apache James In Progress • OpenESB • Drools • Progress Actional Diagnostics • Smooks • FuseHQ • Doozer • Open eHealth Integration Platform • JBossESB • Grails Camel Plugin • Play Framework • Akka • Scalate 74 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  75. 75. Agenda  Who is Claus Ibsen?  The birth of Apache Camel  What is Apache Camel  A little example  Whats included in the box?  Running Camel  The Camel Community  Where are we today?  Where are we going tomorrow?  Q and A 75 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  76. 76. Where are we today?  Some highlights of Apache Camel 2.3 • Overhauled Aggregator EIP • Easier thread pool configuration • Properties component • <routeContext> in Spring XML • 10+ new components 76 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  77. 77. Where are we today?  Overhauled Aggregator EIP • 5 independent completion conditions - size - timeout - interval - predicate - batch consumer • Parallel publishing • Persistent http://hawtdb.fusesource.org/ • Transactional 77 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  78. 78. Where are we today?  Overhauled Aggregator EIP 78 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  79. 79. Where are we today?  Overhauled Aggregator EIP X 79 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  80. 80. Where are we today?  Overhauled Aggregator EIP 80 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  81. 81. Where are we today?  Easier thread pool configuration EIPs Background Tasks Thread Pools Components 81 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  82. 82. Where are we today?  Easier thread pool configuration Background EIPs Tasks Executor Service Strategy Thread Pools Components 82 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  83. 83. Where are we today?  Easier thread pool configuration  ExecutorServiceStrategy • API for creating and lookup thread pools • Consistent thread names • Register pools with JMX • Handle lifecycle (shutdown) Easier for Component writers 83 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  84. 84. Where are we today?  Easier thread pool configuration  ThreadPoolProfile • Template defining pool settings • 1 default profile • 0..n custom profiles <threadPoolProfile id="fooProfile" poolSize="20" maxPoolSize="50" maxQueueSize="200"/> Easier for end users 84 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  85. 85. Where are we today?  Properties Component Properties Component File {{key}} <from uri=“jms:queue:{{inbox}}”/> <to uri=“bean:validateOrder”/> 85 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  86. 86. Where are we today?  <routeContext> in Spring XML • Re-usable route templates (in separate Spring XML files) <routeContext id="myCoolRoutes"> <route id="cool"> <from uri="direct:start"/> <to uri="mock:result"/> </route> myCoolRoutes.xml </routeContext> <import resource="myCoolRoutes.xml"/> <camelContext> <routeContextRef ref="myCoolRoutes"/> </camelContext> 86 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  87. 87. Where are we today?  10+ new components • Properties • Nagios • Netty • Exec • JSR-303 bean validator • Spring Security • Java Cryptographic Extension • OAuth and Google Login to GAE • Eclipse RCP • SOAP (JAXB and JAX-WS) 87 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  88. 88. Agenda  Who is Claus Ibsen?  The birth of Apache Camel  What is Apache Camel  A little example  Whats included in the box?  Running Camel  The Camel Community  Where are we today?  Where are we going tomorrow?  Q and A 88 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  89. 89. Where are we going tomorrow?  Roadmap for Apache Camel 2.4  The major targets • Asynchronous routing engine • OSGi improvements (blueprint etc.) • Security in DSL • Apache ODE component (BPEL) ?  Schedule • GA in Q3 2010 89 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  90. 90. Agenda  Who is Claus Ibsen?  The birth of Apache Camel  What is Apache Camel  A little example  Whats included in the box?  Running Camel  The Camel Community  Where are we today?  Where are we going tomorrow?  Q and A 90 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  91. 91. Q and A  Where do I get more information? - Camel website: http://camel.apache.org - FUSE website: http://fusesource.com - Camel in Action book: http://manning.com/ibsen 91 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  92. 92. Q and A ? 92 © 2009 Progress Software Corporation Tuesday, June 8, 2010
  93. 93. 93 © 2009 Progress Software Corporation Tuesday, June 8, 2010

×