SlideShare a Scribd company logo
1 of 45
Download to read offline
Enterprise Integration
Patterns in Practice
Andreas Egloff
Sun Microsystems
Bruce Snyder
SpringSource
&
What Are Design Patterns?Ā 
A design pattern is a formal way of
documenting a solution to a design
problem in a particular ļ¬eld of expertise.
(Wikipedia)
2
Got EIP?
Core Principles of EIP
> Patterns using asynchronous messaging as a style
of integration
> Pros
ā€¢ Scaling
ā€¢ Decoupling
> Cons
ā€¢ Latency vs. throughput
ā€¢ Decoupling not always appropriate
4
Pattern Overview
5
Identifying and Expressing Patterns
6
Layers of Functionality
> Not an either/or choice, combine layers as
appropriate
7
Message Flow / Service Composition
> Strengths and uses
ā€¢ De-coupling and re-using Services
ā€¢ Easier to evolve
ā€¢ Scaling, Throughput
ā€¢ Asynchronous nature
ā€¢ Message routing, processing, transformation
ā€¢ Easy to mediate
8
Message Endpoints / Services
> Message Endpoints / Services
ā€¢ Message based interface
ā€¢ Expose coarse grained services
ā€¢ Typically stateless
ā€¢ Anticipate re-use
ā€¢ Visibility scope examples
ā€¢ Within application
ā€¢ Within ESB
ā€¢ Anyone with access to JMS server
ā€¢ External
9
Code Composition
> Strengths and uses
ā€¢ Fine grained API access
ā€¢ Stateful, ļ¬ne grained interactions
ā€¢ Low latency
> Challenge
ā€¢ Interface tighter coupled
10
Implicit and Explicit Patterns
> Some patterns inherent in technology / framework
ā€¢ Not every pattern a "keyword"
ā€¢ e.g. JMS publish/subscribe ...
> Patterns realized in user codeĀ 
ā€¢ e.g. Scatter-Gather realized in Java
> Platform has pre-built constructs
ā€¢ e.g.Ā Unix pipe symbol "|" : pipes-and-ļ¬lters Ā 
ā€¢ Route in Camel or Fuji: pipes-and-ļ¬lters
11
Visualizing EIPs
ā€¢ Stencils exist for Visio and OmniGrafļ¬‚eĀ 
ā€¢ http://www.eaipatterns.com/downloads.htmlĀ Ā 
12
Patterns in Practice
13
> Issue: Too little explicit supportĀ out-of-the-box
ā€¢ Too much roll your own
> Issue: Explicit supportĀ out-of-the-boxĀ is too rigid
ā€¢ Does not exactly ļ¬t the use case
ā€¢ Forced to work around or again roll your own
> What you want is out-of-the-box productivity with
explicit constructs AND ļ¬‚exibility to customize the
constructs
Gotcha - Flexibility vs. Productivity
14
Intro to FrameworksĀ 
ā€¢ Apache Camel
ā€¢ http://camel.apache.org/
ā€¢ Project Fuji / OpenESB v3
ā€¢ http://fuji.dev.java.net/
15
What is Apache Camel?Ā 
A framework for simplifying integration
throughĀ the use of theĀ 
Enterprise Integration PatternsĀ for
message mediation, processing,
routing and transformation
http://camel.apache.org/
16
Apache Camel is Focused on EIP
17
http://camel.apache.org/
=>
http://eaipatterns.com/
Message Routing
18
from("A").to("B");
Slightly More Complex Routing
19
from("file:///tmp/myFile.txt").
to("bean:MyBean?method=handleMessage").
to("jms:TEST.Q");
Multicast Routing
20
from("file:///tmp/myFile.txt").
choice().when().
method("MyBean", "matches").
to("Q").
end().
multicast("B", "C", "D");
Pipeline Routing
21
from("file:///tmp/myFile.txt").
choice().when().
method("MyBean", "matches").
to("Q").
end().
pipeline("B", "C", "D");
Camel Components
22
> Ā 70+ components supported
What is Project Fuji?Ā 
> Basis for OpenESB v3
> Fuji Goals
ā€¢ Agility + Flexibility + Ease of Use = ProductivityĀ 
> Service Platform to realize
ā€¢ Service Oriented Architecture (SOA)
ā€¢ Light weight SOA (aka Web Oriented Architecture)
ā€¢ Event Driven Architecture (EDA)
ā€¢ ... last but not least MOM style applicationsĀ 
> > 40 Components in OpenESB community today
http://fuji.dev.java.net/
23
Interesting Properties of FujiĀ 
ā€¢ Convention, Conļ¬guration, Code... in that order
ā€¢ Light weight, OSGi based
ā€¢ Not JMS centric but Service Centric
ā€¢ In-VM service composition option
ā€¢ Choice of transport when going across VMs
ā€¢ E.g. load balancing via http or federating using JXTA
ā€¢ Visual and textual (DSL) editing for EIPs
ā€¢ Camel component is another optionĀ 
24
Web Tooling Option
Service Composition with EIPs in a Browser
25
Web UI Gives the User...
ā€¢ All-in-one interface for service composition
ā€¢ Service Deļ¬nition
ā€¢ Routing, EIPs
ā€¢ Conļ¬guration
ā€¢ Deployment
ā€¢ Layered on textual representation (DSL)
ā€¢ Check out from version control, edit in IDE
ā€¢ Tooling option for different preferences and skills
ā€¢ e.g. casual technologist vs, Developer
ā€¢ Extensible
26
Composition in an IDE / Text Editor
A textual representation of EIPs
> Goals
ā€¢ Simple, concise syntax
ā€¢ Easy to type and read
ā€¢ Top-down design
ā€¢ Generate service templatesĀ 
ā€¢ Concept
ā€¢ used toĀ declareĀ andĀ conļ¬gureĀ services, routing
ā€¢ Sets up services and routing at deployment time;
NOT interpreted on the ļ¬‚y at runtime
"Hello World 1"Ā -Ā 
simple routing
27
Basic Concepts of the DSL
Integration Flow Language
"Hello World 2"Ā -Ā 
pipes-and-ļ¬lters
Output of one ļ¬lter/stage ļ¬‚ows to input of next
stage similar to Unix Pipes
28
Basic Concepts of the DSL
Explicit EIP Constructs
"Hello World 3"Ā -Ā 
adding EIP constructs
29
Example Pattern ImplementationsĀ 
30
Message Routing:Ā Content-Based Router
31
RouteBuilder builder = new RouteBuilder() {
Ā  Ā  public void conļ¬gure() {
Ā  Ā  Ā  from("activemq:NewOrders").
Ā  Ā  Ā  choice().
Ā  Ā  Ā  Ā  Ā  when(header("product").
Ā  Ā  Ā  Ā  Ā  Ā  Ā  isEqualTo("widget")).
Ā  Ā  Ā  Ā  Ā  Ā  Ā  to("http://remotehost:8888/someApp/").
Ā Ā  Ā  Ā  Ā  Ā  Ā  Ā to("activemq:Orders.Widgets").
Ā  Ā  Ā  Ā  Ā  when(header("product").
Ā  Ā  Ā  Ā  Ā  Ā  Ā  isEqualTo("gadget")).
Ā  Ā  Ā  Ā  Ā  Ā  Ā  to("ftp://bsnyder@remotehost/private/reports/").
Ā Ā  Ā  Ā  Ā  Ā  Ā  Ā to("activemq:Orders.Gadgets").
Ā  Ā  Ā  Ā  Ā  otherwise().
Ā  Ā  Ā  Ā  Ā  Ā  Ā  to("activemq:ERRORS");
Ā  Ā  Ā  Ā  }
Ā  Ā  };
}
Apache Camel Java DSL
Message Routing:Ā Content-Based Router
32
<route>
<from uri="activemq:NewOrders"/>
<choice>
<when>
<xpath>/order/product = 'widget'</xpath>
<to uri="activemq:Orders.Widgets"/>
</when>
<when>
<xpath>/order/product = 'gadget'</xpath>
<to uri="activemq:Orders.Gadgets"/>
</when>
<otherwise>
<to uri="activemq:ERRORS"/>
</otherwise>
</choice>
</route>
Apache Camel Spring DSL
Message Channels:Ā Dead Letter ChannelĀ 
33
RouteBuilder builder = new RouteBuilder() {
Ā  Ā  public void conļ¬gure() {
Ā Ā  Ā  Ā  Ā errorHandler(deadLetterChannel("activemq:ERRORS.QUEUE"));
Ā  Ā  Ā  Ā  from("ļ¬le:///tmp/MyFile.txt?delay=2000").
Ā  Ā  Ā  Ā  to("activemq:TEST.Q");
Ā  Ā  Ā  Ā  }
Ā  Ā  };
}
Apache Camel Java DSL
Message Channels:Ā Dead Letter ChannelĀ 
34
<bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder"
Ā  p:deadLetterUri="smtp://mail.springsource.com:25" />
<camelContext id="camel" errorHandlerRef="errorHandler"Ā 
Ā  xmlns="http://camel.apache.org/schema/spring">
Ā  <route>
Ā  Ā  <from uri="seda:a" />
Ā  Ā  <to uri="seda:b" />
Ā  </route>
</camelContext>
Apache Camel Spring DSL
Message Transformation:Ā Content Filter
35
RouteBuilder builder = new RouteBuilder() {
Ā  Ā  public void conļ¬gure() {
Ā  Ā  Ā  Ā  from("activemq:THIS.QUEUE").
Ā  Ā  Ā  Ā  Ā  Ā  process(new Processor() {
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  public void process(Exchange e) {
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Message in = exchange.getIn();
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  in.setBody(in.getBody(String.class) + " Ride the Camel!");
Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  }
Ā  Ā  Ā  Ā  Ā  Ā  }).
Ā  Ā  Ā  Ā  to("activemq:THAT.QUEUE");
Ā  Ā  Ā  Ā  }
Ā  Ā  };
}
Apache Camel Java DSL
Message Transformation:Ā Content Filter
36
<bean id="transformerBean" class="com.mycompany.orders.transform.MyTransformerBean" />
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
Ā  <from uri="activemq:THIS.QUEUE" />
Ā  <bean ref="transformerBean" method="transformMessage" />
Ā  <to uri="activemq:THAT.QUEUE" />
</camelContext>
Apache Camel Spring DSL
Camel Pattern:Ā Throttler
> Limit the number of messages to be sent in a given
time window
> (only send three messages every 10 seconds)
37
public class MyRouteBuilder extends RouteBuilder {
Ā  Ā  public void conļ¬gure() {
Ā  Ā  Ā  from("activemq:TEST.QUEUEā€).
Ā  Ā  Ā  Ā  throttler(3).timePeriodMillis(10000).
Ā  Ā  Ā  Ā  to("http://remotehost:8888/meticProcessingService");
Ā  Ā  }
}
Apache Camel Java DSL
Camel Pattern:Ā Delayer
> Impose a simple delay on messages before being
sent alongĀ 
> (delay messages for a duration of JMSTimestamp
value plus three seconds)
38
public class MyRouteBuilder extends RouteBuilder {
Ā  Ā  public void conļ¬gure() {
Ā  Ā  Ā  from("activemq:TEST.QUEUE").
Ā  Ā  Ā  Ā  delayer(header("JMSTimestamp", 3000).
Ā  Ā  Ā  Ā  to("http://remotehost:8888/meticProcessingService");
Ā  Ā  }
}
Apache Camel Java DSL
Message Routing:Ā Scatter-Gather ("all")
Fuji - DSL and Web UI
39
Message Routing:Ā Scatter-Gather ("best")
Fuji - DSL and Web UI
40
Message Routing:Ā Content-Based Router
Fuji - DSL and Web UI
41
Message Routing:Ā Content-Based Router (dynamic)
ā€¢ CBR rules conļ¬gured at deployment/runtime
Fuji - DSL and Web UI
42
Message Routing:Ā Composed Message Processor
Fuji - DSL and Web UI
43
EIP Product DemoĀ 
ā€¢ Apache Camel
ā€¢ Project Fuji
44
Andreas Egloff
andreas.egloff@sun.com
Bruce Snyder
bruce.snyder@springsource.com

More Related Content

What's hot

JavaCro'14 - Scala and Java EE 7 Development Experiences ā€“ Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences ā€“ Peter PilgrimJavaCro'14 - Scala and Java EE 7 Development Experiences ā€“ Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences ā€“ Peter Pilgrim
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
Ā 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WS
Katrien Verbert
Ā 

What's hot (20)

Java 9
Java 9Java 9
Java 9
Ā 
Faster & Greater Messaging System HornetQ zzz
Faster & Greater Messaging System HornetQ zzzFaster & Greater Messaging System HornetQ zzz
Faster & Greater Messaging System HornetQ zzz
Ā 
JavaCro'14 - Scala and Java EE 7 Development Experiences ā€“ Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences ā€“ Peter PilgrimJavaCro'14 - Scala and Java EE 7 Development Experiences ā€“ Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences ā€“ Peter Pilgrim
Ā 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RS
Ā 
Interoperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITInteroperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSIT
Ā 
Modular JavaScript with CommonJS Compiler
Modular JavaScript with CommonJS CompilerModular JavaScript with CommonJS Compiler
Modular JavaScript with CommonJS Compiler
Ā 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
Ā 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
Ā 
Camel and JBoss
Camel and JBossCamel and JBoss
Camel and JBoss
Ā 
J2EE jsp_01
J2EE jsp_01J2EE jsp_01
J2EE jsp_01
Ā 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with Spring
Ā 
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
MWLUG 2015 - AD114 Take Your XPages Development to the Next LevelMWLUG 2015 - AD114 Take Your XPages Development to the Next Level
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
Ā 
Ā«ReactiveCocoa Šø MVVMĀ» ā€” ŠŠøŠŗŠ¾Š»Š°Š¹ ŠšŠ°ŃŃŒŃŠ½Š¾Š², SoftWear
Ā«ReactiveCocoa Šø MVVMĀ» ā€” ŠŠøŠŗŠ¾Š»Š°Š¹ ŠšŠ°ŃŃŒŃŠ½Š¾Š², SoftWearĀ«ReactiveCocoa Šø MVVMĀ» ā€” ŠŠøŠŗŠ¾Š»Š°Š¹ ŠšŠ°ŃŃŒŃŠ½Š¾Š², SoftWear
Ā«ReactiveCocoa Šø MVVMĀ» ā€” ŠŠøŠŗŠ¾Š»Š°Š¹ ŠšŠ°ŃŃŒŃŠ½Š¾Š², SoftWear
Ā 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
Ā 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WS
Ā 
Petro Gordiievych "From Java 9 to Java 12"
Petro Gordiievych "From Java 9 to Java 12"Petro Gordiievych "From Java 9 to Java 12"
Petro Gordiievych "From Java 9 to Java 12"
Ā 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
Ā 
Mule jdbc
Mule   jdbcMule   jdbc
Mule jdbc
Ā 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technology
Ā 
Connection Pooling
Connection PoolingConnection Pooling
Connection Pooling
Ā 

Similar to EIP In Practice

Service-Oriented Integration With Apache ServiceMix
Service-Oriented Integration With Apache ServiceMixService-Oriented Integration With Apache ServiceMix
Service-Oriented Integration With Apache ServiceMix
Bruce Snyder
Ā 
01 apache camel-intro
01 apache camel-intro01 apache camel-intro
01 apache camel-intro
RedpillLinpro
Ā 

Similar to EIP In Practice (20)

TS 4839 - Enterprise Integration Patterns in Practice
TS 4839 - Enterprise Integration Patterns in PracticeTS 4839 - Enterprise Integration Patterns in Practice
TS 4839 - Enterprise Integration Patterns in Practice
Ā 
Red Hat Open Day JBoss Fuse
Red Hat Open Day JBoss FuseRed Hat Open Day JBoss Fuse
Red Hat Open Day JBoss Fuse
Ā 
Integrating Microservices with Apache Camel
Integrating Microservices with Apache CamelIntegrating Microservices with Apache Camel
Integrating Microservices with Apache Camel
Ā 
Service-Oriented Integration With Apache ServiceMix
Service-Oriented Integration With Apache ServiceMixService-Oriented Integration With Apache ServiceMix
Service-Oriented Integration With Apache ServiceMix
Ā 
Real world #microservices with Apache Camel, Fabric8, and OpenShift
Real world #microservices with Apache Camel, Fabric8, and OpenShiftReal world #microservices with Apache Camel, Fabric8, and OpenShift
Real world #microservices with Apache Camel, Fabric8, and OpenShift
Ā 
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftReal-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Ā 
Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2
Ā 
An introduction to Apache Camel
An introduction to Apache CamelAn introduction to Apache Camel
An introduction to Apache Camel
Ā 
Enterprise Integration Patterns and Apache Camel
Enterprise Integration Patterns and Apache CamelEnterprise Integration Patterns and Apache Camel
Enterprise Integration Patterns and Apache Camel
Ā 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMS
Ā 
Bluemix paas į„€į…µį„‡į…”į†« saas į„€į…¢į„‡į…”į†Æ į„‰į…”į„…į…Ø
Bluemix paas į„€į…µį„‡į…”į†« saas į„€į…¢į„‡į…”į†Æ į„‰į…”į„…į…ØBluemix paas į„€į…µį„‡į…”į†« saas į„€į…¢į„‡į…”į†Æ į„‰į…”į„…į…Ø
Bluemix paas į„€į…µį„‡į…”į†« saas į„€į…¢į„‡į…”į†Æ į„‰į…”į„…į…Ø
Ā 
Exploring Twitter's Finagle technology stack for microservices
Exploring Twitter's Finagle technology stack for microservicesExploring Twitter's Finagle technology stack for microservices
Exploring Twitter's Finagle technology stack for microservices
Ā 
Apache Camel interview Questions and Answers
Apache Camel interview Questions and AnswersApache Camel interview Questions and Answers
Apache Camel interview Questions and Answers
Ā 
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure FunctionsMessaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Ā 
Managing your camels in the cloud with CI/CD
Managing your camels in the cloud with CI/CDManaging your camels in the cloud with CI/CD
Managing your camels in the cloud with CI/CD
Ā 
01 apache camel-intro
01 apache camel-intro01 apache camel-intro
01 apache camel-intro
Ā 
Red Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop LabsRed Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop Labs
Ā 
Mule and web services
Mule and web servicesMule and web services
Mule and web services
Ā 
Splunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the message
Ā 
Divide and Conquer ā€“ Microservices with Node.js
Divide and Conquer ā€“ Microservices with Node.jsDivide and Conquer ā€“ Microservices with Node.js
Divide and Conquer ā€“ Microservices with Node.js
Ā 

More from Bruce Snyder

Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBeyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Bruce Snyder
Ā 
Enterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMSEnterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMS
Bruce Snyder
Ā 
Styles of Applicaton Integration Using Spring
Styles of Applicaton Integration Using SpringStyles of Applicaton Integration Using Spring
Styles of Applicaton Integration Using Spring
Bruce Snyder
Ā 
ActiveMQ In Action
ActiveMQ In ActionActiveMQ In Action
ActiveMQ In Action
Bruce Snyder
Ā 
ActiveMQ In Action - ApacheCon 2011
ActiveMQ In Action - ApacheCon 2011ActiveMQ In Action - ApacheCon 2011
ActiveMQ In Action - ApacheCon 2011
Bruce Snyder
Ā 
Apache ActiveMQ and Apache ServiceMix
Apache ActiveMQ and Apache ServiceMixApache ActiveMQ and Apache ServiceMix
Apache ActiveMQ and Apache ServiceMix
Bruce Snyder
Ā 
Messaging With Apache ActiveMQ
Messaging With Apache ActiveMQMessaging With Apache ActiveMQ
Messaging With Apache ActiveMQ
Bruce Snyder
Ā 
Enterprise Messaging With ActiveMQ and Spring JMS
Enterprise Messaging With ActiveMQ and Spring JMSEnterprise Messaging With ActiveMQ and Spring JMS
Enterprise Messaging With ActiveMQ and Spring JMS
Bruce Snyder
Ā 
Taking Apache Camel For a Ride
Taking Apache Camel For a RideTaking Apache Camel For a Ride
Taking Apache Camel For a Ride
Bruce Snyder
Ā 

More from Bruce Snyder (13)

Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBeyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Ā 
Enterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMSEnterprise Messaging With Spring JMS
Enterprise Messaging With Spring JMS
Ā 
Styles of Applicaton Integration Using Spring
Styles of Applicaton Integration Using SpringStyles of Applicaton Integration Using Spring
Styles of Applicaton Integration Using Spring
Ā 
ActiveMQ In Action
ActiveMQ In ActionActiveMQ In Action
ActiveMQ In Action
Ā 
ActiveMQ In Action - ApacheCon 2011
ActiveMQ In Action - ApacheCon 2011ActiveMQ In Action - ApacheCon 2011
ActiveMQ In Action - ApacheCon 2011
Ā 
Apache ActiveMQ and Apache ServiceMix
Apache ActiveMQ and Apache ServiceMixApache ActiveMQ and Apache ServiceMix
Apache ActiveMQ and Apache ServiceMix
Ā 
Messaging With Apache ActiveMQ
Messaging With Apache ActiveMQMessaging With Apache ActiveMQ
Messaging With Apache ActiveMQ
Ā 
Enterprise Messaging With ActiveMQ and Spring JMS
Enterprise Messaging With ActiveMQ and Spring JMSEnterprise Messaging With ActiveMQ and Spring JMS
Enterprise Messaging With ActiveMQ and Spring JMS
Ā 
Taking Apache Camel For a Ride
Taking Apache Camel For a RideTaking Apache Camel For a Ride
Taking Apache Camel For a Ride
Ā 
Service Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixService Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMix
Ā 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A Ride
Ā 
Messaging With ActiveMQ
Messaging With ActiveMQMessaging With ActiveMQ
Messaging With ActiveMQ
Ā 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A Ride
Ā 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
Ā 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(ā˜Žļø+971_581248768%)**%*]'#abortion pills for sale in dubai@
Ā 

Recently uploaded (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Ā 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
Ā 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
Ā 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Ā 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
Ā 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
Ā 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Ā 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
Ā 
Elevate Developer Efficiency & build GenAI Application with Amazon Qā€‹
Elevate Developer Efficiency & build GenAI Application with Amazon Qā€‹Elevate Developer Efficiency & build GenAI Application with Amazon Qā€‹
Elevate Developer Efficiency & build GenAI Application with Amazon Qā€‹
Ā 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Ā 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Ā 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Ā 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
Ā 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
Ā 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Ā 
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Ā 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Ā 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Ā 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
Ā 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
Ā 

EIP In Practice

  • 1. Enterprise Integration Patterns in Practice Andreas Egloff Sun Microsystems Bruce Snyder SpringSource &
  • 2. What Are Design Patterns?Ā  A design pattern is a formal way of documenting a solution to a design problem in a particular ļ¬eld of expertise. (Wikipedia) 2
  • 4. Core Principles of EIP > Patterns using asynchronous messaging as a style of integration > Pros ā€¢ Scaling ā€¢ Decoupling > Cons ā€¢ Latency vs. throughput ā€¢ Decoupling not always appropriate 4
  • 7. Layers of Functionality > Not an either/or choice, combine layers as appropriate 7
  • 8. Message Flow / Service Composition > Strengths and uses ā€¢ De-coupling and re-using Services ā€¢ Easier to evolve ā€¢ Scaling, Throughput ā€¢ Asynchronous nature ā€¢ Message routing, processing, transformation ā€¢ Easy to mediate 8
  • 9. Message Endpoints / Services > Message Endpoints / Services ā€¢ Message based interface ā€¢ Expose coarse grained services ā€¢ Typically stateless ā€¢ Anticipate re-use ā€¢ Visibility scope examples ā€¢ Within application ā€¢ Within ESB ā€¢ Anyone with access to JMS server ā€¢ External 9
  • 10. Code Composition > Strengths and uses ā€¢ Fine grained API access ā€¢ Stateful, ļ¬ne grained interactions ā€¢ Low latency > Challenge ā€¢ Interface tighter coupled 10
  • 11. Implicit and Explicit Patterns > Some patterns inherent in technology / framework ā€¢ Not every pattern a "keyword" ā€¢ e.g. JMS publish/subscribe ... > Patterns realized in user codeĀ  ā€¢ e.g. Scatter-Gather realized in Java > Platform has pre-built constructs ā€¢ e.g.Ā Unix pipe symbol "|" : pipes-and-ļ¬lters Ā  ā€¢ Route in Camel or Fuji: pipes-and-ļ¬lters 11
  • 12. Visualizing EIPs ā€¢ Stencils exist for Visio and OmniGrafļ¬‚eĀ  ā€¢ http://www.eaipatterns.com/downloads.htmlĀ Ā  12
  • 14. > Issue: Too little explicit supportĀ out-of-the-box ā€¢ Too much roll your own > Issue: Explicit supportĀ out-of-the-boxĀ is too rigid ā€¢ Does not exactly ļ¬t the use case ā€¢ Forced to work around or again roll your own > What you want is out-of-the-box productivity with explicit constructs AND ļ¬‚exibility to customize the constructs Gotcha - Flexibility vs. Productivity 14
  • 15. Intro to FrameworksĀ  ā€¢ Apache Camel ā€¢ http://camel.apache.org/ ā€¢ Project Fuji / OpenESB v3 ā€¢ http://fuji.dev.java.net/ 15
  • 16. What is Apache Camel?Ā  A framework for simplifying integration throughĀ the use of theĀ  Enterprise Integration PatternsĀ for message mediation, processing, routing and transformation http://camel.apache.org/ 16
  • 17. Apache Camel is Focused on EIP 17 http://camel.apache.org/ => http://eaipatterns.com/
  • 19. Slightly More Complex Routing 19 from("file:///tmp/myFile.txt"). to("bean:MyBean?method=handleMessage"). to("jms:TEST.Q");
  • 22. Camel Components 22 > Ā 70+ components supported
  • 23. What is Project Fuji?Ā  > Basis for OpenESB v3 > Fuji Goals ā€¢ Agility + Flexibility + Ease of Use = ProductivityĀ  > Service Platform to realize ā€¢ Service Oriented Architecture (SOA) ā€¢ Light weight SOA (aka Web Oriented Architecture) ā€¢ Event Driven Architecture (EDA) ā€¢ ... last but not least MOM style applicationsĀ  > > 40 Components in OpenESB community today http://fuji.dev.java.net/ 23
  • 24. Interesting Properties of FujiĀ  ā€¢ Convention, Conļ¬guration, Code... in that order ā€¢ Light weight, OSGi based ā€¢ Not JMS centric but Service Centric ā€¢ In-VM service composition option ā€¢ Choice of transport when going across VMs ā€¢ E.g. load balancing via http or federating using JXTA ā€¢ Visual and textual (DSL) editing for EIPs ā€¢ Camel component is another optionĀ  24
  • 25. Web Tooling Option Service Composition with EIPs in a Browser 25
  • 26. Web UI Gives the User... ā€¢ All-in-one interface for service composition ā€¢ Service Deļ¬nition ā€¢ Routing, EIPs ā€¢ Conļ¬guration ā€¢ Deployment ā€¢ Layered on textual representation (DSL) ā€¢ Check out from version control, edit in IDE ā€¢ Tooling option for different preferences and skills ā€¢ e.g. casual technologist vs, Developer ā€¢ Extensible 26
  • 27. Composition in an IDE / Text Editor A textual representation of EIPs > Goals ā€¢ Simple, concise syntax ā€¢ Easy to type and read ā€¢ Top-down design ā€¢ Generate service templatesĀ  ā€¢ Concept ā€¢ used toĀ declareĀ andĀ conļ¬gureĀ services, routing ā€¢ Sets up services and routing at deployment time; NOT interpreted on the ļ¬‚y at runtime "Hello World 1"Ā -Ā  simple routing 27
  • 28. Basic Concepts of the DSL Integration Flow Language "Hello World 2"Ā -Ā  pipes-and-ļ¬lters Output of one ļ¬lter/stage ļ¬‚ows to input of next stage similar to Unix Pipes 28
  • 29. Basic Concepts of the DSL Explicit EIP Constructs "Hello World 3"Ā -Ā  adding EIP constructs 29
  • 31. Message Routing:Ā Content-Based Router 31 RouteBuilder builder = new RouteBuilder() { Ā  Ā  public void conļ¬gure() { Ā  Ā  Ā  from("activemq:NewOrders"). Ā  Ā  Ā  choice(). Ā  Ā  Ā  Ā  Ā  when(header("product"). Ā  Ā  Ā  Ā  Ā  Ā  Ā  isEqualTo("widget")). Ā  Ā  Ā  Ā  Ā  Ā  Ā  to("http://remotehost:8888/someApp/"). Ā Ā  Ā  Ā  Ā  Ā  Ā  Ā to("activemq:Orders.Widgets"). Ā  Ā  Ā  Ā  Ā  when(header("product"). Ā  Ā  Ā  Ā  Ā  Ā  Ā  isEqualTo("gadget")). Ā  Ā  Ā  Ā  Ā  Ā  Ā  to("ftp://bsnyder@remotehost/private/reports/"). Ā Ā  Ā  Ā  Ā  Ā  Ā  Ā to("activemq:Orders.Gadgets"). Ā  Ā  Ā  Ā  Ā  otherwise(). Ā  Ā  Ā  Ā  Ā  Ā  Ā  to("activemq:ERRORS"); Ā  Ā  Ā  Ā  } Ā  Ā  }; } Apache Camel Java DSL
  • 32. Message Routing:Ā Content-Based Router 32 <route> <from uri="activemq:NewOrders"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:Orders.Widgets"/> </when> <when> <xpath>/order/product = 'gadget'</xpath> <to uri="activemq:Orders.Gadgets"/> </when> <otherwise> <to uri="activemq:ERRORS"/> </otherwise> </choice> </route> Apache Camel Spring DSL
  • 33. Message Channels:Ā Dead Letter ChannelĀ  33 RouteBuilder builder = new RouteBuilder() { Ā  Ā  public void conļ¬gure() { Ā Ā  Ā  Ā  Ā errorHandler(deadLetterChannel("activemq:ERRORS.QUEUE")); Ā  Ā  Ā  Ā  from("ļ¬le:///tmp/MyFile.txt?delay=2000"). Ā  Ā  Ā  Ā  to("activemq:TEST.Q"); Ā  Ā  Ā  Ā  } Ā  Ā  }; } Apache Camel Java DSL
  • 34. Message Channels:Ā Dead Letter ChannelĀ  34 <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder" Ā  p:deadLetterUri="smtp://mail.springsource.com:25" /> <camelContext id="camel" errorHandlerRef="errorHandler"Ā  Ā  xmlns="http://camel.apache.org/schema/spring"> Ā  <route> Ā  Ā  <from uri="seda:a" /> Ā  Ā  <to uri="seda:b" /> Ā  </route> </camelContext> Apache Camel Spring DSL
  • 35. Message Transformation:Ā Content Filter 35 RouteBuilder builder = new RouteBuilder() { Ā  Ā  public void conļ¬gure() { Ā  Ā  Ā  Ā  from("activemq:THIS.QUEUE"). Ā  Ā  Ā  Ā  Ā  Ā  process(new Processor() { Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  public void process(Exchange e) { Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Message in = exchange.getIn(); Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  in.setBody(in.getBody(String.class) + " Ride the Camel!"); Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  } Ā  Ā  Ā  Ā  Ā  Ā  }). Ā  Ā  Ā  Ā  to("activemq:THAT.QUEUE"); Ā  Ā  Ā  Ā  } Ā  Ā  }; } Apache Camel Java DSL
  • 36. Message Transformation:Ā Content Filter 36 <bean id="transformerBean" class="com.mycompany.orders.transform.MyTransformerBean" /> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> Ā  <from uri="activemq:THIS.QUEUE" /> Ā  <bean ref="transformerBean" method="transformMessage" /> Ā  <to uri="activemq:THAT.QUEUE" /> </camelContext> Apache Camel Spring DSL
  • 37. Camel Pattern:Ā Throttler > Limit the number of messages to be sent in a given time window > (only send three messages every 10 seconds) 37 public class MyRouteBuilder extends RouteBuilder { Ā  Ā  public void conļ¬gure() { Ā  Ā  Ā  from("activemq:TEST.QUEUEā€). Ā  Ā  Ā  Ā  throttler(3).timePeriodMillis(10000). Ā  Ā  Ā  Ā  to("http://remotehost:8888/meticProcessingService"); Ā  Ā  } } Apache Camel Java DSL
  • 38. Camel Pattern:Ā Delayer > Impose a simple delay on messages before being sent alongĀ  > (delay messages for a duration of JMSTimestamp value plus three seconds) 38 public class MyRouteBuilder extends RouteBuilder { Ā  Ā  public void conļ¬gure() { Ā  Ā  Ā  from("activemq:TEST.QUEUE"). Ā  Ā  Ā  Ā  delayer(header("JMSTimestamp", 3000). Ā  Ā  Ā  Ā  to("http://remotehost:8888/meticProcessingService"); Ā  Ā  } } Apache Camel Java DSL
  • 42. Message Routing:Ā Content-Based Router (dynamic) ā€¢ CBR rules conļ¬gured at deployment/runtime Fuji - DSL and Web UI 42
  • 43. Message Routing:Ā Composed Message Processor Fuji - DSL and Web UI 43
  • 44. EIP Product DemoĀ  ā€¢ Apache Camel ā€¢ Project Fuji 44