Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Simplify your integrations with Apache Camel

3,874 views

Published on

To build up any non-trivial business processing, you may have to connect systems that are exposed by web-services, fire off events over message queues, notify users via email or social networking, and much more.

Apache Camel is a lightweight integration framework that helps you connect systems in a consistent and reliable way. Focus on the business reasons behind what's being integrated, not the underlying details of how.

Published in: Technology, Education
  • Be the first to comment

Simplify your integrations with Apache Camel

  1. 1. Simplify Enterprise Integration With Apache Camel Christian Posta Principal Consultant and Architect 12/16/13 1
  2. 2. Agenda • • • • • 2 What is Integration? What is Apache Camel Why Apache Camel? Example Questions?
  3. 3. Your speaker Christian Posta Blog: http://christianposta.com/blog Twitter: @christianposta Email: christian@redhat.com ceposta@apache.org • Principal Consultant and Architect at Red Hat (FuseSource) • Based in Phoenix, AZ • Committer on Apache Camel, ActiveMQ, Apollo • PMC on ActiveMQ • Author: Essential Camel Components DZone Refcard 3
  4. 4. Poll: Estimate how long to implement the following usecase: Consume XML messages from a queue, call a SOAP webservice if the message is an “alert” message, store data to the file system Options: • Less than 1 day • A few Days • A few weeks • A few months • Cannot be done 4
  5. 5. What is Integration? 5 5
  6. 6. Integration? 6
  7. 7. Integration… 7
  8. 8. Just use one computer. No integration needed. 8
  9. 9. Why is integration hard? • Off the shelf? Home Grown? Acquisition? • Platforms • Protocols / Data Formats • Data Formats • Timing • Organizational mismatch 9
  10. 10. Commercial Solutions? 10
  11. 11. Enterprise Service Bus? 11
  12. 12. Enterprise Service Bus… 12
  13. 13. Extract the heart of ESB • Protocol mediation • Routing • Transformation • EIPs • Start small, build up • Open Source • Community driven 13
  14. 14. Patterns FTW! • Common language!!!!! • Specific context • Forces at work • Concrete solution • Guidance • Other patterns… • 65 patterns 14
  15. 15. What is Apache Camel? 15 15
  16. 16. Proud parents of Camel 16
  17. 17. Apache Camel Apache Camel is an open-source, light-weight, integration library. Use Camel to integrate disparate systems that speak different protocols and data formats 17
  18. 18. Why the name Camel? • Can carry more weight that other beasts? • James fancied cigarettes? • A horse designed by committee? 18 Concise Application Messaging Exchange Language
  19. 19. What is Apache Camel? • Light-weight integration library • Enterprise Integration Patterns • Components • Domain Specific Language • Routing and Mediation (like an ESB?) • Runs in any container (or stand alone) 19
  20. 20. Not an ESB…per-se… • An integration library • • • Routing (content-based, dynamic, rules-engine…) Mediation (xformations, protocols, wire transports…) DSL • Can build an ESB (real ESB.. Not just box in the middle) • Many options based on Camel! • • • • 20 Fuse ESB / JBoss Fuse Apache ServiceMix (Karaf + Camel) Talend, wso2, others… Not tied to vendor lock-in and commercial licenses!
  21. 21. Very popular • Used at top companies in finance, shipping, retail/e-retail, health care, airline reservations, etc • E*Trade: http://goo.gl/FDqgpV • • Sabre: http://goo.gl/RrWcQ5 21 CERN: http://goo.gl/vEO7zR
  22. 22. Open source • • • Apache Software Foundation ASL v 2.0 Licensed Vibrant community • • 22 Jira, mailing list, github Lots of contributions! Check out the components!
  23. 23. Quick Example 23 23
  24. 24. Quick Example File System 24 Message Oriented Middleware
  25. 25. Quick Example From A 25 Filter message Send to B
  26. 26. Quick Example from(A) 26 filter(predicate) to(B)
  27. 27. Quick Example from(A) 27 .filter(isWidget) .to(B)
  28. 28. Quick Example isWidget = xpath(“/quote/product = ‘widget’”); from(A) .filter(isWidget). to(B) 28
  29. 29. Using Camel 29 29
  30. 30. Pipes and Filters • Step by Step – “Processors” in Camel terminology • Complex processing – “Routes” • Flexible • Testing • Reuse 30
  31. 31. Camel Routes • Defined in Java, XML, Scala, Groovy • Step by step processing of a message: • Consumer – Listen for incoming message • Zero or more “filters” or Processors • Producer – Send outgoing message • Number of processing filters, or “Processors” in Camel-speak • EIPs • Tranform, redirect, enrich 31
  32. 32. Domain Specific Language • Domain specific (integration) • Used to build and describe Camel Routes • Embedded within a general programming language • Java, Spring XML, Scala, Groovy • Take advantage of existing tools • Fluent builders (builder pattern…) • 32 from(“..”).enrich(“…”).filter(“..”).to(“…”);
  33. 33. Java DSL public class OrderProcessorRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { } } from(“activemq:orders”) .choice() .when(header(“customer-rating”).isEqualTo(“gold”)) .to(“ibmmq:topic:specialCustomer”) .otherwise() .to(“ftp://user@host/orders/regularCustomers”) .end() .log(“received new order ${body.orderId}”) .to(“ibatis:storeOrder?statementType=Insert”); 33
  34. 34. Spring XML DSL <route id=“processOrders”> <from uri=“activemq:orders”/> <choice> <when> <simple>${header.customer-rating} == ‘gold’</simple> <to uri=“ibmmq:topic:specialCustomer”> </when> <otherwise> <to uri=“ftp://user@host/orders/regularCustomers” /> </otherwise> </choice> <log message=“received new order ${body.orderId}”/> <to uri=“ibatis:storeOrder?statementType=Insert”/> </route> 34
  35. 35. Enterprise Integration Patterns • Message Routing • Transformation • Aggregation • Splitting • Resequencer • Routing Slip • Enricher • All 65 from the book! 35
  36. 36. Components • Prepackaged bits of code • Highly configurable • Maximum interoperability • Used to build “Adapters” to existing systems • Don’t reinvent the wheel and end up with a box 36
  37. 37. Components http://camel.apache.org/components.html • ActiveMQ, Websphere, Weblogic (JMS) • GMail • AMQP • HTTP • ATOM feeds • IRC • AWS (S3, SQS, SNS, others) • jclouds • Bean • JDBC • Cache (EHCache) • Jetty • CXF (JAX-WS, JAX-RS) • Twitter • EJB • MQTT • Drools • MyBatis • File • JPA • FTP • Spring Integration • Google App Engine • Spring Web Services 37 To see list of all components!!
  38. 38. Components • URI format: • scheme:localPart[?options] from(“aws-sqs://demo?defaultVisibilityTimeout=2”) • scheme: identifies the “component” • localPart: specific to the component • options: is a list of name-value pairs • Creates endpoints based on configuration • Route endpoint “factories” • Integrate with Camel Routes by creating producer/consumer endpoints 38
  39. 39. Another Example public class MyExampleRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { from(“aws-sqs://demo?defaultVisibilityTimeout=2”) .setHeader(“type”).jsonpath(“$[‘type’]”) .filter(simple(“${header.type} == ‘login’”) } .to(“jms:quote”); } 39
  40. 40. Test Framework • Powerful way to test your Camel routes • http://camel.apache.org/mock.html • Uses Mocks • Mocks vs Stubs? • http://martinfowler.com/articles/mocksArentStubs.html • Provides declarative testing mechanism • Declare • Test • Assert 40
  41. 41. Management with HawtIO http://hawt.io 41
  42. 42. Developer Tooling Support Fuse IDE 42
  43. 43. JBoss Fuse (aka Fuse ESB) Integrate Everything! 43
  44. 44. More info on JBoss Fuse… http://www.jboss.org/products/fuse https://www.redhat.com/products/jbossenterprisemiddleware/fuse/ 44
  45. 45. Live Demo 45 45
  46. 46. Resources 46 46
  47. 47. Presentation Resources 47
  48. 48. Professional Training Camel Development with Red Hat JBoss Fuse (Online Training) http://www.redhat.com/training/courses/jb421r/ Red Hat JBoss A-MQ Development and Deployment (Online Training) https://www.redhat.com/training/courses/jb437r/ Red Hat Certificate of Expertise in Camel Development http://www.redhat.com/training/certifications/jbcd-cameldevelopment/ 48
  49. 49. Dzone Refcardz REFCARDZ • Camel Essential Components • http://refcardz.dzone.com/refcardz/essential-camel-components • Essential EIP with Apache Camel • http://refcardz.dzone.com/refcardz/enterprise-integration 49
  50. 50. Apache Community • http://camel.apache.org • Mailing list: users@camel.apache.org • Nabble Archive: http://camel.465427.n5.nabble.com/Camel-Users- f465428.html • Source code: https://git-wip-us.apache.org/repos/asf?p=camel.git • Blogs, Articles, Examples • http://www.davsclaus.com • http://www.christianposta.com/blog • http://www.ossmentor.com/ • http://camel.apache.org/articles.html • http://camel.apache.org/user-stories.html • http://camel.apache.org/user-stories.html 50
  51. 51. Apache Camel Books 51
  52. 52. Apache Camel Books 52
  53. 53. Apache Camel Books 53
  54. 54. Questions 54

×