Successfully reported this slideshow.
Your SlideShare is downloading. ×

Apache camel: Swiss Knife of Integrations

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 45 Ad
Advertisement

More Related Content

Recently uploaded (20)

Advertisement

Apache camel: Swiss Knife of Integrations

  1. 1. APACHE CAMEL: SWISS KNIFE OF INTEGRATIONS Justinas Šlekas
  2. 2. Agenda • Integrations and Integration Patterns • What is Apache Camel? • Why Apache Camel? • Camel basics • Demo • Questions
  3. 3. Why do we need integration?
  4. 4. Where does complexity come from? Much of the complexity comes from two issues: • dealing with the specifics of applications and transports • coming up with good solutions to integration problems
  5. 5. Integrations patterns - Visual pattern language for message-based enterprise integration solutions - Pattern language comprises of 65 patterns in 6 categories
  6. 6. Enterprise Integration Patterns
  7. 7. Why the name Camel?
  8. 8. Camel’s parents
  9. 9. What is Apache Camel? • Java framework for integration and mediation • Enterprise Integration Patterns • Domain Specific Languages: • Fluent Java • Spring XML • Blueprint XML • Scala • Runs in any container (or stand alone) • Over > 150 out-of-box components • Active community
  10. 10. Why Apache Camel? • Why Integration Framework? • Framework do the heavy lifting • You can focus on business problem • Not "reinventing the wheel"
  11. 11. Why Apache Camel? • Integration can be messy - variety of protocols and data formats • Framework hides all complexity so you can focus on your business logic
  12. 12. Apache Camel Deployment Known ContainersDeployment Strategy • No container dependency • Lightweight • Embeddable Deployment Options • Standalone • WAR • Spring • J2EE • JBI • OSGi • Cloud • Apache ServiceMix • Apache ActiveMQ • Apache Tomcat • Jetty • JBoss • IBM WebSphere • Oracle WebLogic • Oracle OC4j • Glassfish • Google App Engine • ... others
  13. 13. Apache Camel Components • Highly configurable • Maximum interoperability • Used to build “Adapters” to existing systems • Don’t reinvent the wheel and end up with a box
  14. 14. (Some) Standard components • AHC - Async HTTP client • Atom • AMPQ • AWS-* - Amazon cloud services • Bean - Bean binding • DNS - DNS look-up • Dropbox • JPA • File & FTP • HBase • HTTP • LDAP • MongoDB • Mustache • Netty • POP3 • RabbitMQ • Salesforce • Servlet • JMS & ActiveMQ • SQL • SSH • Validation - XML validation • Websocket • XMPP • Activiti BPMN • Smooks
  15. 15. Why Camel? That’s why…
  16. 16. Apache Camel Concept Camel is Message-oriented → Concept of Message Communication in Camel takes places via Message Message is included in Exchange
  17. 17. Apache Camel: Exchange • Exchange = Wrapper object • encapsulates Messages (IN and OUT) and Metadata
  18. 18. Apache Camel: Endpoint Endpoint defines the communication port of an application from(“file://C:/data/in”) to(“sftp://localhost:22/data/out”)
  19. 19. Apache Camel: Route Route defines strategies for message manipulation
  20. 20. Camel Architecture
  21. 21. Working with Camel Messages Camel Processor: • Java interface used to implement message consumers or Message Translator EIP • you can create a Component from a Processor
  22. 22. Camel Processor
  23. 23. Apache Camel Bean • Bean as Message Translator
  24. 24. Apache Camel Bean (2) • Bean as Message Translator
  25. 25. Little Example • File Copier Example
  26. 26. File Copier Example Java DSL
  27. 27. File copier example XML DSL route: <route> <from uri=“file://data/inbox”> <to uri=“file://data/outbox”> </route> Java DSL route: from(“file://data/inbox”).to(“file://data/outbox”)
  28. 28. What else is there? • Error handling • EIP annotations • Test Kit • Transactions • Concurrency • Interceptors • Security • Data Transformation • Load Balancing • ...
  29. 29. EIPAnnotations
  30. 30. Consumer Endpoint in Camel Bean
  31. 31. Producer Endpoint in Camel Bean
  32. 32. Transactions Make client session with messaging system transactional • uses Spring transactions • Transactional endpoints: JMS, ActiveMQ, AMPQ, JPA
  33. 33. Error Handling Two distinct types: • transactional • non-transactional Can configure policies like: • message redelivery • dead-letter queue
  34. 34. Error Handling: Try - Catch
  35. 35. Load Balancer EIP • delegate processing based on load balancing policies • out-of-the-box-policies: • Round robin • Random • Sticky • Topic • Failover • Weighted Round-robin • Weighted random ○ Custom
  36. 36. Load Balancer example
  37. 37. Camel as a Client • Java Client Application (no routes) • Example • Upload a file to a FTP server
  38. 38. Testing • Camel provides some very powerful Unit Testing capabilities. Its MockEndpoint class supports complex expressions to validate your routes.
  39. 39. Testing Test Kit • camel-test camel-test-spring • camel-test-blueprint
  40. 40. Hawt.io - ultimate admin console • lightweight html5 modular web-console • open-source (JBoss Cummunity project) • discovers what the JVM is running (JMX, other) and exposes a web UI • lots of plugins: ○ ActiveMQ ○ Camel ○ OSGi ○ Karaf ○ JMX ○ …..
  41. 41. Management with Hawt.io • View/edit Camel Routes • ActiveMQ - browse/send • Monitor system resources • Inspect JMX
  42. 42. When NOT to use Apache Camel? • Integrating just one or two technologies (Could be simpler to use other libraries) • Very large integration projects (use ESB’s: Apache ServiceMix, Mule ESB)
  43. 43. Summary • Apache Camel: The Swiss Army Knife of Integration • Lightweight • Multiple container support • Developer friendly • Feature (a lot of components) • Scalability • Easy adoption in enterprises • Development • Testing • Operations friendly • License
  44. 44. DEMO • Live demonstration
  45. 45. Speaker: Justinas Slekas contacts: justas.slekas@gmail.com Questions?

×