Enterprise Integration Patterns with Apache Camel

6,285 views
5,871 views

Published on

Enterprise integration patterns, Apache Camel, EIP

Published in: Technology, Education
1 Comment
11 Likes
Statistics
Notes
No Downloads
Views
Total views
6,285
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
267
Comments
1
Likes
11
Embeds 0
No embeds

No notes for slide

Enterprise Integration Patterns with Apache Camel

  1. 1. Enterprise Integration Patterns with Apache Camel Ioan Eugen Stan 20 Septembrie 2013 Axway Kickoff
  2. 2. ● Why = The purpose - What is you cause? What do you belive in? ● How = The Process - specifc actions taken to realize the Why ● What = The result - what do you do, the result of Why. Proof. TED, Simon Sinek, May 2010
  3. 3. Why do we need integration? A integra = include, a (se) îngloba, a (se) încorpora, a (se) armoniza într-un tot.
  4. 4. Why EIP Where does complexity come from? Much of the complexity stems from two issues: ● dealing with the specifics of applications and transports ● coming up with good solutions to integration problems
  5. 5. The Book ● 65 design patterns ● Formalized language ● Covers: ○ Integration Styles ○ Messaging Systems ○ Message Construction ○ Message Routing ○ Message Transformation ○ Messaging Endpoints ○ System Management
  6. 6. EIPs in detail (1) Message Pipes and Filters Message translator Message router Messaging Systems
  7. 7. EIPs in detail (2) Point to Point channel Publish Subscribe Channel Dead letter queue Guaranteed delivery Messaging Channels
  8. 8. EIPs in detail (3) Event message Request reply Correlation identifier Return Address Messaging Construction
  9. 9. EIPs in detail (4) Content based router Message filter Dynamic router Recipient list Messaging Routing
  10. 10. EIPs in detail (5) Splitter Aggregator Resequencer Routing slip Messaging Routing
  11. 11. EIPs in detail (6) Content enricher Content filter Claim check Normalizer Messaging Transformation
  12. 12. EIPs in detail (7) Event driven consumer Pooling consumer Transactional client Service activator Messaging Endpoints
  13. 13. EIPs in detail (8) Control bus Detour Wire Tap System Management
  14. 14. Flight Mash-up Image from: http://appzdevelop.blogspot.ro/2012/02/apache-camel-flight-aggregation-mashup.html Code: https://code.google.com/p/apache-camel-mashup/
  15. 15. Purchase example
  16. 16. Normalization Transform multiple message types into a common format
  17. 17. Other examples
  18. 18. Apache Camel ● java framework for integration and mediation ● rules in multiple DSLs: ○ Fluent Java ○ Spring XML ○ Blueprint XML ○ Scala ● over > 150 out-of-box components ● bean binding and integration with popular frameworks ● active comunity ~ 900 messages/month
  19. 19. Camel Architecture Image from: http://java.dzone.com/articles/open-source-integration-apache (Camel in Action)
  20. 20. Basics ● create a CamelContext ● optionally configure components or endpoints ● add routing rules ● start the context
  21. 21. Example Java DSL
  22. 22. Example Spring DSL
  23. 23. Vocabulary: Component & Endpoint ● Component is an Endpoint factory ● Enpoints are refered by URIs: file://, jms:// ● Has methods: ○ createProducer() ○ createConsumer() ○ createPoolingConsumer()
  24. 24. (Some) Standard components ● AHC - Async HTTP client ● Atom ● AMPQ ● AWS-* - Amazon cloud services ● Bean - Bean binding ● DNS - DNS look-up ● Elasticsearch ● 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
  25. 25. Vocabulary: Exchange ● Exchange = Wrapper object ● encapsulates Messages (IN and OUT) and Metadata
  26. 26. ● Java interface used to implement message consumers or Message Translator EIP ● you can create a Component from a Processor Camel Processor
  27. 27. Remember Processing files with Apache Camel
  28. 28. Content Based Router EIP Route messages to destination based on message contents
  29. 29. Content Based Router - Spring DSL
  30. 30. Normalizer EIP
  31. 31. Camel ETL - sample ● read files from src/data/ directory ● convert content to PersonDocument class using TypeConvertor system (JAXB) ● persist to DB using JPA component using TypeConvertor ● read from DB with JPA component as entity class ● convert entity to XML file with JAXB and File component
  32. 32. Transactional Client EIP Make client session with messaging system transactional ● uses Spring transactions ● Transactional endpoints: JMS, ActiveMQ, AMPQ, JPA Camel also supports Transactional Routes
  33. 33. Transactional Client
  34. 34. Load Balancer Pattern ● delegate processing based on load balancing policies ● out-of-the-box-policies: ○ Round robin ○ Random ○ Sticky ○ Topic ○ Failover ○ Weighted Round-robin ○ Weighted random ○ Custom
  35. 35. Load Balancer
  36. 36. Error Handling Two distinct types: ● transactional ● non-transactional Can configure policies like: ● message redelivery ● dead-letter queue
  37. 37. Error Handling - Try - Catch
  38. 38. Error Handling - Dead Letter Queue ● exceptions caught by Dead Letter Channel - which decides either: ○ to redeliver ○ or send to dead letted queue
  39. 39. Camel BAM ● business activity monitoring framework ● monitor business processes across multiple exchanges ● works across different endpoints For every purchase order created by A, B generates an invoice.
  40. 40. Flight Mash-up revisited
  41. 41. Tooling: Fuse IDE ● Eclipse based RedHat JBoss product ● build Camel routes graphically (Spring XML DSL) ● import existing XML routes ● comes with pre-defined EIP building blocks ● view local and remote ActiveMq brokers, Camel end-points and routes ● trace Camel routes at run-time
  42. 42. Fuse IDE - diagram view
  43. 43. Hawt.io - ultimate admin console ● lightweight html5 modular web-console ● open-source (JBoss Cumunity project) ● discovers what the JVM is running (JMX, other) and exposes a web UI ● lots of plugins: ○ ActiveMQ - default console for 5.9.x ○ Camel - view/control routes ○ OSGi - view/control bundles ○ Karaf ○ JMX ○ …..
  44. 44. Hawt.io - view routes
  45. 45. Hawt.io - ActiveMQ - browse/send
  46. 46. Hawt.io - monitor
  47. 47. Hawt.io - inspect JMX
  48. 48. Conclusions ● Camel is awesome tehnology ● easy to get started ● very powerfull ● the comunity is great and helpful
  49. 49. Întrebări?
  50. 50. Resources ● http://camel.apache.org ● https://access.redhat.com/site/documentation/Fuse_ESB_Enterprise/ ● http://www.eaipatterns.com/ ● http://java.dzone.com/articles/open-source-integration-apache ● http://activemq.apache.org/ ● http://hawt.io/ ● http://fusesource.com/products/fuse-ide/ ● https://code.google.com/p/apache-camel-mashup/ ● http://appzdevelop.blogspot.ro/2012/02/apache-camel-flight-aggregation- mashup.html
  51. 51. Contact ● stan.ieugen@gmail.com ● ieugen@apache.org ● http://github.com/ieugen/ ● ro.linkedin.com/in/ieugen/

×