SlideShare a Scribd company logo
1 of 33
Enterprise Integration Patterns 
with Spring Integration 
[Mihalache Catalin] 
[Pentalog] 
[25th of October 2014]
Agenda 
• Spring Integration – 10.000 foot view 
• Enterprise Integration Patterns - WGRUS 
– What is integration? 
– How to address integration challenges 
– Messaging / what are EIP Patterns ? 
• EIP with Spring Integration (SI) 
• WGRUS flows 
• Study resources
Spring Integration – 10.000 foot view 
• Enterprise Application Integration solution 
– integration of systems and applications across an enterprise 
• Spring Integration pillars (axioms): 
– Spring programming model 
● probably the most popular Java framework 
– Enterprise Integration Patterns 
● Gregor Hohpe , Bobby Woolf - 2003 
● Foreward by Martin Fowler 
(Patterns of Enterprise Application Architecture) 
● Asynchronous, message-driven behavior 
within a Spring-based application 
● Intuitive, incremental adoption for existing Spring users 
● Default integration with HTTP, JMS, AMQP, FTP, JDBC, JPA 
Mail, Mongo, RMI, Web Services, Twitter, XMPP, File systems
EIP – What is integration? 
Widgets & Gadgets ‘R Us (WGRUS) - an online retailer that buys widgets and gadgets from 
manufacturers and resells them to customers on multiple channels (by phone, fax orders, web 
interface). 
WGRUS & external systems WGRUS's internal systems 
• Call center: 
C++ desktop application / Oracle database server – it allows customers to place orders via phone. Apps 
sources cannot / may not be modified. 
• Inbound fax: 
The inbound fax system requires manual data entry into a small Microsoft Access application. 
• Web Interface: 
JEE custom built web app allowing customers to browse widgets & gadgets, place orders, monitor orders 
status. Apps sources may / can be modified.
EIP – Why integration is necessary ? 
What is needed 
Take Orders 
Customers can place orders on multiple 
channels - via Web, phone or fax 
Processing Orders 
Processing an order involves multiple steps, 
including verifying inventory, shipping the goods and 
invoicing the customer (integrate all backend 
systems) 
New Catalog 
The suppliers update their catalog 
periodically. WGRUS needs to update its pricing and 
availability based in the new catalogs. 
Challenges 
Networks are unreliable 
Networks are slow 
Any two applications are different 
Change is inevitable
EIP – How to address integration challenges 
1. File Transfer - the MS Office 
database from the Inbound Fax System is 
copied periodically to a specific network file 
location; the Integration Solution will recover 
it from that location, process it by importing 
any new order and later delete it. 
2. Shared Database - the Call Center 
application's sources cannot / may not 
changed. However, since it uses an Oracle 
database server, the creation of new orders 
might be monitored with a trigger on insert 
(on the “orders” table). That trigger would 
copy new order details into a new created 
table “orders_si”. A separate application 
would connect to these database, 
monitoring the “orders_si” table and each 
time a new record is created, it will notify the 
Integration Solution with order details; later 
on, that new “orders_si” record would be 
deleted. 
3. Remote Procedure Invocation - WGRUS needs to update its pricing 
and availability based in the new catalogs by running some HTTP SOAP web 
service calls to “Widget Co” and “Gadget Co” external systems; those systems 
respond back with their current catalogs & prices.
EIP – How to address integration challenges 
4. Messaging - after a new order is 
placed, the web app detects that order 
and publishes a new message on a specific 
JMS queue. This message contains new 
order's details. And that's it, the web app 
'forgets' about that message returning to 
its job. 
The messaging system is notified by the 
JMS queue with an event about the new 
order. It can start processing that order.
EIP – Messaging / what are EIP Patterns ?
EIP with Spring Integration - Message 
public interface Message<T> { 
MessageHeaders getHeaders(); 
T getPayload(); 
} 
public final class MessageHeaders 
implements Map<String, Object>, Serializable{ 
... 
} 
Message<String> message1 = MessageBuilder.withPayload("test").setHeader("foo", "bar").build(); 
Spring Integration Messages are immutable! 
Best practice: the payload / headers would have to be immutable and serializable.
EIP with Spring Integration - Channel
EIP with Spring Integration - Channel 
• EIP name: Point-to-Point Channel 
• Message consumer: Event-Driven Consumer 
• A channel that invokes a single subscriber for 
each sent Message. The invocation will occur in 
the sender's thread. It uses an 
UnicastingDispatcher without a thread executor. 
Failover support. 
<channel id=directChannel" /> 
<channel id=directChannel2"> 
<dispatcher failover="true" load-balancer="round-robin" /> 
</channel> 
<transformer id="t1" input-channel="directChannel" 
output-channel="outputChannel" 
ref="myTransformerBean"/>
EIP with Spring Integration - Channel 
• EIP name: Point-to-Point Channel 
• Message consumer: Event-Driven Consumer 
• A channel that invokes a single subscriber for 
each sent Message. The invocation will occur on 
executor's threads. It uses an 
UnicastingDispatcher with a thread executor. 
Failover support. 
<channel id=”executorChannel”> 
<dispatcher task-executor=”someExecutor”/> 
</channel> 
<transformer id="t2" input-channel="executorChannel" 
output-channel="outputChannel" 
ref="myTransformerBean"/>
EIP with Spring Integration - Channel 
• EIP name: Publish-Subscribe Channel 
• Message consumer: Event-Driven Consumer 
• A channel that sends the Message to each one of its 
subscribers. The invocation occurs on the sender's 
thread (if no executor is specified) or on separate 
threads for each receiver (if an executor is specified). 
It uses an BroadcastingDispatcher with an optional 
thread executor. 
<publish-subscribe-channel id="pubSubChannel" 
task-executor="someExecutor"/> 
<transformer id="t1" input-channel="pubSubChannel" 
output-channel="outputChannel1" ref="myTransformerBean1"/> 
<transformer id="t2" input-channel="pubSubChannel" 
output-channel="outputChannel2" ref="myTransformerBean2"/> 
<filter id="f1" input-channel="pubSubChannel" 
output-channel="outputChannel3"/>
EIP with Spring Integration - Channel 
• EIP name: Point-to-Point Channel 
• Message consumer: Polling Consumer 
• Simple implementation of a message channel. Each 
Message is placed in a BlockingQueue whose capacity 
may be specified upon construction. By default, it uses 
a LinkedBlockingQueue but a MessageGroupQueue 
might be used to store messages on a persistent 
context (like a relational database) – basically, using a 
MessageStore 
<channel id=”queueChannel”> 
<queue capacity="25" /> 
</channel> 
<channel id=”queueChannel” > 
<queue message-store="myMessageStore" /> 
</channel> 
<jdbc:message-store id="myMessageStore" data-source="mySqlDataSource"/>
EIP with Spring Integration - Channel 
• Sending messages on a channel: 
@Autowired 
@Qualifier(“myChannelID”); 
private DirectChannel channel; 
public void sendMessage(String msgPayload) { 
final MessagingTemplate mt = new MessagingTemplate(); 
final Message<String> msg = 
MessageBuilder.withPayload(msgPayload).build(); 
mt.send(channel, msg); 
}
EIP with SI – Polling Consumer 
• Polling consumers: a consumer with a PollableChannel as its input channel 
• Sync / Async polling consumers 
• <channel id=”queueChannel”> 
<queue message-store="myMessageStore" /> 
</channel> 
<jdbc:message-store id="myMessageStore" data-source="mySqlDataSource" /> 
<transformer id="t3" input-channel="queueChannel" 
output-channel="outputChannel" ref="myTransformerBean"> 
<poller fixed-rate="10" receive-timeout="60000" 
task-executor="myTaskExecutor"> 
<transactional isolation="REPEATABLE_READ" 
transaction-manager="txManager" propagation="REQUIRED" /> 
</poller> 
</transformer>
EIP with SI – Event-driven Consumers 
• Event driven consumers: a consumer with a SubscribableChannel as its input channel 
• <channel id="directChannel" /> 
<transformer id="t3" input-channel="directChannel" 
output-channel="outputChannel" ref="myTransformerBean" />
EIP with SI – Channel Adapter 
• A Channel Adapter is a component that connects a single sender or receiver to a Message Channel. 
(outside of the sender/receiver; one way communication) 
• JMS inbound channel adapter: 
<jms:message-driven-channel-adapter id="jmsIn" destination="requestQueue" 
channel="jmsInChannel" /> 
<channel id="jmsInChannel" /> 
• JMS outbound channel adapter: 
<channel id="stdinToJmsoutChannel"/> 
<jms:outbound-channel-adapter id="jmsout" channel="stdinToJmsoutChannel" 
destination="requestQueue"/> 
• Predefined channel adapters: JMS, AMQP, JDBC, JPA, Mongo, Redis, FTP, Twitter
EIP with SI – Gateways 
• A Gateway is a Message Endpoint that connects an application that is both a sender and receiver to a 
Message Channel. (inside the application; two-way communication). 
• The 'default' gateway allows Java code to call a Spring Integration flow as a Spring service: 
<gateway id="myGateway" default-request-channel="inputChannel" 
default-reply-channel="outputChannel" service-interface="fr.pentalog.si.MyGateway"> 
<method name="process"> 
<header name="configuredHeader" value="abc"/> 
</method> 
</gateway> 
<channel id="inputChannel" /> 
<channel id="outputChannel" /> 
• Async gateways: 
public interface MyGateway { 
public String process(String thing, 
<gateway id="myGateway" default-request-channel="inputChannel" 
default-reply-channel="outputChannel" service-interface="fr.pentalog.si.MyGatewayy" 
async-executor="myExecutor"> 
<method name="process" /> 
</gateway> 
• Predefined gateways: 
– JMS, AMQP, HTTP, Web Services, Redis, JDBC 
@Header(FileHeaders.FILENAME) 
String fileName); 
} 
public interface MyGateway { 
public Feature<String> process(String thing, 
@Header(FileHeaders.FILENAME) 
String fileName); 
}
EIP with SI – Service Activator 
• A service activator in Spring Integration simply connects any existing Spring-managed bean to a channel. 
These Spring service beans may or may not return a result. 
• <service-activator id="myServiceActivator" input-channel="inputChannel" output-channel="outputChannel" 
ref="barista" method="prepareHotDrink" /> 
@Service("barista") 
public class Barista { 
@Transactional 
public Drink prepareHotDrink(OrderItem orderItem) { 
... 
} 
}
EIP with SI – Transformer 
<transformer input-channel="callCenterOrdersChannel" output-channel="canonicalOrdersChannel" 
ref="transformer" method="transform"/> 
<beans:bean id="transformer" class="fr.pentalog.si.CallCenterOrderTransformer" /> 
public class CallCenterOrderTransformer { 
public CanonicalOrder transform(CallCenterOrder order) { 
...; 
} 
} 
<object-to-json-transformer 
input-channel="newOrders" 
output-channel="jsonNewOrders" />
EIP with SI – Claim Check 
<bean id="mongoDbFactory" class="org.springframework.data.mongodb.core.SimpleMongoDbFactory"> … 
</bean> 
<bean id="mongoDbMessageStore" 
class="org.springframework.integration.mongodb.store.MongoDbMessageStore"> 
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" /> 
<constructor-arg name="collectionName" ref="myClaimCheck" /> 
</bean> 
<chain input-channel="inputChannel" output-channel="channel2"> 
<object-to-json-transformer id="orderToJson" /> 
<claim-check-in id=”claimCheckIn” message-store=”mongoDbMessageStore” /> 
</chain> 
<claim-check-out id="claimCheckOut" 
input-channel="channel2" 
output-channel="output3" message-store="mongoDbMessageStore"/>
EIP with SI – Filter 
<filter input-channel="inputChannel2" output-channel="outputChannel" 
discard-channel="discardChannel2" 
ref="petFilter" method="dogsOnly" /> 
<beans:bean id="dogsOnly" class="fr.pentalog.fr.PetFilter"/> 
public class PetFilter { 
public boolean dogsOnly(String input) { 
return input.toLowerCase().contains("dog"); 
} 
} 
<filter input-channel="inputChannel2" output-channel="outputChannel" 
throw-exception-on-rejection="true" 
ref="petFilter" method="dogsOnly" />
EIP with SI – Splitter 
<channel id="ordersChannel" /> 
<channel id="itemsChannel" /> 
<splitter input-channel="ordersChannel" output-channel="itemsChannel" apply-sequence="true" 
ref="ordersSplitter" method="splitOrder"> 
</splitter> 
<beans:bean id="ordersSplitter" class="fr.pentalog.si.OrdersSplitter" /> 
public class OrdersSplitter { 
public List<CanonicalItem> splitOrder(CanonicalOrder order) { 
return null; 
} 
} 
The Splitter adds following headers in Item messages (for an Order with 2 items): 
{correlationId=d7c96f28-b9b5-1c8b-1881-8d4b09d83c6b, sequenceSize=2, sequenceNumber=1} 
{ correlationId=d7c96f28-b9b5-1c8b-1881-8d4b09d83c6b, sequenceSize=2, sequenceNumber=2}
EIP with SI – Aggregator 
<aggregator input-channel="itemsChannel" output-channel="ordersChannel" 
ref="itemsAggregator" method="aggregate" message-store="myMessageStore"> 
</aggregator> 
<beans:bean id="itemsAggregator" class="fr.pentalog.si.ItemsAggregator" /> 
public class ItemsAggregator { 
public CanonicalOrder splitOrder(List<CanonicalItem> items) { 
... 
} 
} 
CorrelationId, SequenceSize, SequenceNumber 
Statefull component - it might use a message store to keep messages upon completion. 
Correlation Strategy – how to identify thow messages belong to the same group 
ReleaseStrategy – how to detect that a group of messages is complete 
Timeouts – time to wait a group of messages upon completion 
Discard channel – where expired messages will be published 
Partial Aggregation – if not all expected messages are to come
EIP with SI – Router 
<channel id="itemInputChannel"/> 
<router id="router1" input-channel="itemInputChannel" ref="orderRouter" method="route" /> 
<router id="router2" input-channel="itemInputChannel" ref="orderRouter" method="route"> 
<mapping value="widget" channel="widgetItemOrderChannel" /> 
<mapping value="gadget" channel="gadgetItemOrderChannel" /> 
</router> 
<beans:bean class="fr.pentalog.si.OrderRouter"/> 
public class OrderRouter { 
public String route(CanonicalOrderItem order) { 
... 
} 
}
Spring Integration – Error Handling 
Default channels: 
errorChannel 
used internally for sending error messages and may be overridden with a custom configuration 
nullChannel 
acts like /dev/null, simply logging any Message sent to it at DEBUG level and returning immediately
WGRUS – Taking Orders
WGRUS – Processing Orders
Study resources 
Spring Integration in Action – written by SI's creators 
Enterprise Integration Patterns
Please fill the online evaluation form after event 
[Enterprise Integration Patterns with Spring Integration] 
[Mihalache Catalin] 
[Pentalog] 
[25th of October 2014]

More Related Content

What's hot

Component bindings in mule
Component bindings in muleComponent bindings in mule
Component bindings in muleSindhu VL
 
Mule Custom Aggregator
Mule Custom AggregatorMule Custom Aggregator
Mule Custom AggregatorAnkush Sharma
 
Push to the limit - rich and pro-active user interfaces with ADF - V2 (UKOUG,...
Push to the limit - rich and pro-active user interfaces with ADF - V2 (UKOUG,...Push to the limit - rich and pro-active user interfaces with ADF - V2 (UKOUG,...
Push to the limit - rich and pro-active user interfaces with ADF - V2 (UKOUG,...Lucas Jellema
 
Testing mule
Testing   muleTesting   mule
Testing muleSindhu VL
 
Push to the limit - rich and pro-active user interfaces with ADF (Oracle Ope...
Push to the limit - rich and pro-active user interfaces with ADF  (Oracle Ope...Push to the limit - rich and pro-active user interfaces with ADF  (Oracle Ope...
Push to the limit - rich and pro-active user interfaces with ADF (Oracle Ope...Lucas Jellema
 
Junit in mule demo
Junit in mule demoJunit in mule demo
Junit in mule demoSudha Ch
 
Introduction to Kafka with Spring Integration
Introduction to Kafka with Spring IntegrationIntroduction to Kafka with Spring Integration
Introduction to Kafka with Spring IntegrationBorislav Markov
 
Mule tcat server - Server profiles
Mule tcat server - Server profilesMule tcat server - Server profiles
Mule tcat server - Server profilesShanky Gupta
 
Mule generic connector
Mule generic connectorMule generic connector
Mule generic connectorAnkush Sharma
 
Mule concepts transformers
Mule concepts transformersMule concepts transformers
Mule concepts transformerskunal vishe
 
Mule system properties
Mule system propertiesMule system properties
Mule system propertiesGandham38
 
Mule for each scope header collection
Mule for each scope header collectionMule for each scope header collection
Mule for each scope header collectionPraneethchampion
 
Mule expression component
Mule expression componentMule expression component
Mule expression componentKarnam Karthik
 

What's hot (19)

Mule esb usecase
Mule esb usecaseMule esb usecase
Mule esb usecase
 
Component bindings in mule
Component bindings in muleComponent bindings in mule
Component bindings in mule
 
Spring Integration
Spring IntegrationSpring Integration
Spring Integration
 
Mule Custom Aggregator
Mule Custom AggregatorMule Custom Aggregator
Mule Custom Aggregator
 
Push to the limit - rich and pro-active user interfaces with ADF - V2 (UKOUG,...
Push to the limit - rich and pro-active user interfaces with ADF - V2 (UKOUG,...Push to the limit - rich and pro-active user interfaces with ADF - V2 (UKOUG,...
Push to the limit - rich and pro-active user interfaces with ADF - V2 (UKOUG,...
 
Mule: Java Transformer
Mule: Java TransformerMule: Java Transformer
Mule: Java Transformer
 
Testing mule
Testing   muleTesting   mule
Testing mule
 
Push to the limit - rich and pro-active user interfaces with ADF (Oracle Ope...
Push to the limit - rich and pro-active user interfaces with ADF  (Oracle Ope...Push to the limit - rich and pro-active user interfaces with ADF  (Oracle Ope...
Push to the limit - rich and pro-active user interfaces with ADF (Oracle Ope...
 
Junit in mule demo
Junit in mule demoJunit in mule demo
Junit in mule demo
 
Introduction to Kafka with Spring Integration
Introduction to Kafka with Spring IntegrationIntroduction to Kafka with Spring Integration
Introduction to Kafka with Spring Integration
 
Mule esb
Mule esbMule esb
Mule esb
 
Dataweave in studio
Dataweave in studioDataweave in studio
Dataweave in studio
 
Mule tcat server - Server profiles
Mule tcat server - Server profilesMule tcat server - Server profiles
Mule tcat server - Server profiles
 
Mule generic connector
Mule generic connectorMule generic connector
Mule generic connector
 
Mule concepts transformers
Mule concepts transformersMule concepts transformers
Mule concepts transformers
 
Mule system properties
Mule system propertiesMule system properties
Mule system properties
 
Mule for each scope header collection
Mule for each scope header collectionMule for each scope header collection
Mule for each scope header collection
 
Mule expression component
Mule expression componentMule expression component
Mule expression component
 
Mule java part-1
Mule java part-1Mule java part-1
Mule java part-1
 

Similar to Mihalache catalin eip with spring integration

quickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationquickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationjorgesimao71
 
Software Architectures, Week 4 - Message-based Architectures, Message Bus
Software Architectures, Week 4 - Message-based Architectures, Message BusSoftware Architectures, Week 4 - Message-based Architectures, Message Bus
Software Architectures, Week 4 - Message-based Architectures, Message BusAngelos Kapsimanis
 
Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Opevel
 
Guide to Spring Reactive Programming using WebFlux
Guide to Spring Reactive Programming using WebFluxGuide to Spring Reactive Programming using WebFlux
Guide to Spring Reactive Programming using WebFluxInexture Solutions
 
Red Hat Open Day JBoss Fuse
Red Hat Open Day JBoss FuseRed Hat Open Day JBoss Fuse
Red Hat Open Day JBoss FuseAdrian Gigante
 
Reactive solutions using java 9 and spring reactor
Reactive solutions using java 9 and spring reactorReactive solutions using java 9 and spring reactor
Reactive solutions using java 9 and spring reactorOrenEzer1
 
Data Microservices with Spring Cloud
Data Microservices with Spring CloudData Microservices with Spring Cloud
Data Microservices with Spring CloudOrkhan Gasimov
 
iiwas 2010
iiwas 2010iiwas 2010
iiwas 2010steccami
 
CMPE282_009994036_PROJECT_REPORT
CMPE282_009994036_PROJECT_REPORTCMPE282_009994036_PROJECT_REPORT
CMPE282_009994036_PROJECT_REPORTSandyarathi Das
 
WSO2Con USA 2015: WSO2 Integration Platform Deep Dive
WSO2Con USA 2015: WSO2 Integration Platform Deep DiveWSO2Con USA 2015: WSO2 Integration Platform Deep Dive
WSO2Con USA 2015: WSO2 Integration Platform Deep DiveWSO2
 
Mule ESB Interview or Certification questions
Mule ESB Interview or Certification questionsMule ESB Interview or Certification questions
Mule ESB Interview or Certification questionsTechieVarsity
 
Building Continuous Application with Structured Streaming and Real-Time Data ...
Building Continuous Application with Structured Streaming and Real-Time Data ...Building Continuous Application with Structured Streaming and Real-Time Data ...
Building Continuous Application with Structured Streaming and Real-Time Data ...Databricks
 
Developing, Administering and Debugging with WSO2 Enterprise Integrator
Developing, Administering and Debugging with WSO2 Enterprise IntegratorDeveloping, Administering and Debugging with WSO2 Enterprise Integrator
Developing, Administering and Debugging with WSO2 Enterprise IntegratorWSO2
 
Measuring IPv6 using ad-based measurement
Measuring IPv6 using ad-based measurementMeasuring IPv6 using ad-based measurement
Measuring IPv6 using ad-based measurementAPNIC
 
How to – wrap soap web service around a database
How to – wrap soap web service around a databaseHow to – wrap soap web service around a database
How to – wrap soap web service around a databaseSon Nguyen
 
slides-117-opsawg-a-data-manifest-for-contextualized-telemetry-data-00.pdf
slides-117-opsawg-a-data-manifest-for-contextualized-telemetry-data-00.pdfslides-117-opsawg-a-data-manifest-for-contextualized-telemetry-data-00.pdf
slides-117-opsawg-a-data-manifest-for-contextualized-telemetry-data-00.pdfThomasGraf42
 

Similar to Mihalache catalin eip with spring integration (20)

quickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationquickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integration
 
Software Architectures, Week 4 - Message-based Architectures, Message Bus
Software Architectures, Week 4 - Message-based Architectures, Message BusSoftware Architectures, Week 4 - Message-based Architectures, Message Bus
Software Architectures, Week 4 - Message-based Architectures, Message Bus
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011
 
Guide to Spring Reactive Programming using WebFlux
Guide to Spring Reactive Programming using WebFluxGuide to Spring Reactive Programming using WebFlux
Guide to Spring Reactive Programming using WebFlux
 
Red Hat Open Day JBoss Fuse
Red Hat Open Day JBoss FuseRed Hat Open Day JBoss Fuse
Red Hat Open Day JBoss Fuse
 
Reactive solutions using java 9 and spring reactor
Reactive solutions using java 9 and spring reactorReactive solutions using java 9 and spring reactor
Reactive solutions using java 9 and spring reactor
 
Data Microservices with Spring Cloud
Data Microservices with Spring CloudData Microservices with Spring Cloud
Data Microservices with Spring Cloud
 
iiwas 2010
iiwas 2010iiwas 2010
iiwas 2010
 
CMPE282_009994036_PROJECT_REPORT
CMPE282_009994036_PROJECT_REPORTCMPE282_009994036_PROJECT_REPORT
CMPE282_009994036_PROJECT_REPORT
 
Art Of Message Queues
Art Of Message QueuesArt Of Message Queues
Art Of Message Queues
 
WSO2Con USA 2015: WSO2 Integration Platform Deep Dive
WSO2Con USA 2015: WSO2 Integration Platform Deep DiveWSO2Con USA 2015: WSO2 Integration Platform Deep Dive
WSO2Con USA 2015: WSO2 Integration Platform Deep Dive
 
Mule ESB Interview or Certification questions
Mule ESB Interview or Certification questionsMule ESB Interview or Certification questions
Mule ESB Interview or Certification questions
 
Building Continuous Application with Structured Streaming and Real-Time Data ...
Building Continuous Application with Structured Streaming and Real-Time Data ...Building Continuous Application with Structured Streaming and Real-Time Data ...
Building Continuous Application with Structured Streaming and Real-Time Data ...
 
Developing, Administering and Debugging with WSO2 Enterprise Integrator
Developing, Administering and Debugging with WSO2 Enterprise IntegratorDeveloping, Administering and Debugging with WSO2 Enterprise Integrator
Developing, Administering and Debugging with WSO2 Enterprise Integrator
 
Measuring IPv6 using ad-based measurement
Measuring IPv6 using ad-based measurementMeasuring IPv6 using ad-based measurement
Measuring IPv6 using ad-based measurement
 
How to – wrap soap web service around a database
How to – wrap soap web service around a databaseHow to – wrap soap web service around a database
How to – wrap soap web service around a database
 
Axis2
Axis2Axis2
Axis2
 
Resume
ResumeResume
Resume
 
slides-117-opsawg-a-data-manifest-for-contextualized-telemetry-data-00.pdf
slides-117-opsawg-a-data-manifest-for-contextualized-telemetry-data-00.pdfslides-117-opsawg-a-data-manifest-for-contextualized-telemetry-data-00.pdf
slides-117-opsawg-a-data-manifest-for-contextualized-telemetry-data-00.pdf
 

More from Codecamp Romania

Cezar chitac the edge of experience
Cezar chitac   the edge of experienceCezar chitac   the edge of experience
Cezar chitac the edge of experienceCodecamp Romania
 
Business analysis techniques exercise your 6-pack
Business analysis techniques   exercise your 6-packBusiness analysis techniques   exercise your 6-pack
Business analysis techniques exercise your 6-packCodecamp Romania
 
Bpm company code camp - configuration or coding with pega
Bpm company   code camp - configuration or coding with pegaBpm company   code camp - configuration or coding with pega
Bpm company code camp - configuration or coding with pegaCodecamp Romania
 
Andrei prisacaru takingtheunitteststothedatabase
Andrei prisacaru takingtheunitteststothedatabaseAndrei prisacaru takingtheunitteststothedatabase
Andrei prisacaru takingtheunitteststothedatabaseCodecamp Romania
 
2015 dan ardelean develop for windows 10
2015 dan ardelean   develop for windows 10 2015 dan ardelean   develop for windows 10
2015 dan ardelean develop for windows 10 Codecamp Romania
 
The case for continuous delivery
The case for continuous deliveryThe case for continuous delivery
The case for continuous deliveryCodecamp Romania
 
Stefan stolniceanu spritekit, 2 d or not 2d
Stefan stolniceanu   spritekit, 2 d or not 2dStefan stolniceanu   spritekit, 2 d or not 2d
Stefan stolniceanu spritekit, 2 d or not 2dCodecamp Romania
 
Sizing epics tales from an agile kingdom
Sizing epics   tales from an agile kingdomSizing epics   tales from an agile kingdom
Sizing epics tales from an agile kingdomCodecamp Romania
 
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
Raluca butnaru corina cilibiu   the unknown universe of a product and the cer...Raluca butnaru corina cilibiu   the unknown universe of a product and the cer...
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...Codecamp Romania
 
Parallel & async processing using tpl dataflow
Parallel & async processing using tpl dataflowParallel & async processing using tpl dataflow
Parallel & async processing using tpl dataflowCodecamp Romania
 
Material design screen transitions in android
Material design screen transitions in androidMaterial design screen transitions in android
Material design screen transitions in androidCodecamp Romania
 
Kickstart your own freelancing career
Kickstart your own freelancing careerKickstart your own freelancing career
Kickstart your own freelancing careerCodecamp Romania
 
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
Ionut grecu   the soft stuff is the hard stuff. the agile soft skills toolkitIonut grecu   the soft stuff is the hard stuff. the agile soft skills toolkit
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkitCodecamp Romania
 
Diana antohi me against myself or how to fail and move forward
Diana antohi   me against myself  or how to fail  and move forwardDiana antohi   me against myself  or how to fail  and move forward
Diana antohi me against myself or how to fail and move forwardCodecamp Romania
 

More from Codecamp Romania (20)

Cezar chitac the edge of experience
Cezar chitac   the edge of experienceCezar chitac   the edge of experience
Cezar chitac the edge of experience
 
Cloud powered search
Cloud powered searchCloud powered search
Cloud powered search
 
Ccp
CcpCcp
Ccp
 
Business analysis techniques exercise your 6-pack
Business analysis techniques   exercise your 6-packBusiness analysis techniques   exercise your 6-pack
Business analysis techniques exercise your 6-pack
 
Bpm company code camp - configuration or coding with pega
Bpm company   code camp - configuration or coding with pegaBpm company   code camp - configuration or coding with pega
Bpm company code camp - configuration or coding with pega
 
Andrei prisacaru takingtheunitteststothedatabase
Andrei prisacaru takingtheunitteststothedatabaseAndrei prisacaru takingtheunitteststothedatabase
Andrei prisacaru takingtheunitteststothedatabase
 
Agility and life
Agility and lifeAgility and life
Agility and life
 
2015 dan ardelean develop for windows 10
2015 dan ardelean   develop for windows 10 2015 dan ardelean   develop for windows 10
2015 dan ardelean develop for windows 10
 
The bigrewrite
The bigrewriteThe bigrewrite
The bigrewrite
 
The case for continuous delivery
The case for continuous deliveryThe case for continuous delivery
The case for continuous delivery
 
Stefan stolniceanu spritekit, 2 d or not 2d
Stefan stolniceanu   spritekit, 2 d or not 2dStefan stolniceanu   spritekit, 2 d or not 2d
Stefan stolniceanu spritekit, 2 d or not 2d
 
Sizing epics tales from an agile kingdom
Sizing epics   tales from an agile kingdomSizing epics   tales from an agile kingdom
Sizing epics tales from an agile kingdom
 
Scale net apps in aws
Scale net apps in awsScale net apps in aws
Scale net apps in aws
 
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
Raluca butnaru corina cilibiu   the unknown universe of a product and the cer...Raluca butnaru corina cilibiu   the unknown universe of a product and the cer...
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
 
Parallel & async processing using tpl dataflow
Parallel & async processing using tpl dataflowParallel & async processing using tpl dataflow
Parallel & async processing using tpl dataflow
 
Material design screen transitions in android
Material design screen transitions in androidMaterial design screen transitions in android
Material design screen transitions in android
 
Kickstart your own freelancing career
Kickstart your own freelancing careerKickstart your own freelancing career
Kickstart your own freelancing career
 
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
Ionut grecu   the soft stuff is the hard stuff. the agile soft skills toolkitIonut grecu   the soft stuff is the hard stuff. the agile soft skills toolkit
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
 
Ecma6 in the wild
Ecma6 in the wildEcma6 in the wild
Ecma6 in the wild
 
Diana antohi me against myself or how to fail and move forward
Diana antohi   me against myself  or how to fail  and move forwardDiana antohi   me against myself  or how to fail  and move forward
Diana antohi me against myself or how to fail and move forward
 

Recently uploaded

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Mihalache catalin eip with spring integration

  • 1. Enterprise Integration Patterns with Spring Integration [Mihalache Catalin] [Pentalog] [25th of October 2014]
  • 2.
  • 3. Agenda • Spring Integration – 10.000 foot view • Enterprise Integration Patterns - WGRUS – What is integration? – How to address integration challenges – Messaging / what are EIP Patterns ? • EIP with Spring Integration (SI) • WGRUS flows • Study resources
  • 4. Spring Integration – 10.000 foot view • Enterprise Application Integration solution – integration of systems and applications across an enterprise • Spring Integration pillars (axioms): – Spring programming model ● probably the most popular Java framework – Enterprise Integration Patterns ● Gregor Hohpe , Bobby Woolf - 2003 ● Foreward by Martin Fowler (Patterns of Enterprise Application Architecture) ● Asynchronous, message-driven behavior within a Spring-based application ● Intuitive, incremental adoption for existing Spring users ● Default integration with HTTP, JMS, AMQP, FTP, JDBC, JPA Mail, Mongo, RMI, Web Services, Twitter, XMPP, File systems
  • 5. EIP – What is integration? Widgets & Gadgets ‘R Us (WGRUS) - an online retailer that buys widgets and gadgets from manufacturers and resells them to customers on multiple channels (by phone, fax orders, web interface). WGRUS & external systems WGRUS's internal systems • Call center: C++ desktop application / Oracle database server – it allows customers to place orders via phone. Apps sources cannot / may not be modified. • Inbound fax: The inbound fax system requires manual data entry into a small Microsoft Access application. • Web Interface: JEE custom built web app allowing customers to browse widgets & gadgets, place orders, monitor orders status. Apps sources may / can be modified.
  • 6. EIP – Why integration is necessary ? What is needed Take Orders Customers can place orders on multiple channels - via Web, phone or fax Processing Orders Processing an order involves multiple steps, including verifying inventory, shipping the goods and invoicing the customer (integrate all backend systems) New Catalog The suppliers update their catalog periodically. WGRUS needs to update its pricing and availability based in the new catalogs. Challenges Networks are unreliable Networks are slow Any two applications are different Change is inevitable
  • 7. EIP – How to address integration challenges 1. File Transfer - the MS Office database from the Inbound Fax System is copied periodically to a specific network file location; the Integration Solution will recover it from that location, process it by importing any new order and later delete it. 2. Shared Database - the Call Center application's sources cannot / may not changed. However, since it uses an Oracle database server, the creation of new orders might be monitored with a trigger on insert (on the “orders” table). That trigger would copy new order details into a new created table “orders_si”. A separate application would connect to these database, monitoring the “orders_si” table and each time a new record is created, it will notify the Integration Solution with order details; later on, that new “orders_si” record would be deleted. 3. Remote Procedure Invocation - WGRUS needs to update its pricing and availability based in the new catalogs by running some HTTP SOAP web service calls to “Widget Co” and “Gadget Co” external systems; those systems respond back with their current catalogs & prices.
  • 8. EIP – How to address integration challenges 4. Messaging - after a new order is placed, the web app detects that order and publishes a new message on a specific JMS queue. This message contains new order's details. And that's it, the web app 'forgets' about that message returning to its job. The messaging system is notified by the JMS queue with an event about the new order. It can start processing that order.
  • 9. EIP – Messaging / what are EIP Patterns ?
  • 10. EIP with Spring Integration - Message public interface Message<T> { MessageHeaders getHeaders(); T getPayload(); } public final class MessageHeaders implements Map<String, Object>, Serializable{ ... } Message<String> message1 = MessageBuilder.withPayload("test").setHeader("foo", "bar").build(); Spring Integration Messages are immutable! Best practice: the payload / headers would have to be immutable and serializable.
  • 11. EIP with Spring Integration - Channel
  • 12. EIP with Spring Integration - Channel • EIP name: Point-to-Point Channel • Message consumer: Event-Driven Consumer • A channel that invokes a single subscriber for each sent Message. The invocation will occur in the sender's thread. It uses an UnicastingDispatcher without a thread executor. Failover support. <channel id=directChannel" /> <channel id=directChannel2"> <dispatcher failover="true" load-balancer="round-robin" /> </channel> <transformer id="t1" input-channel="directChannel" output-channel="outputChannel" ref="myTransformerBean"/>
  • 13. EIP with Spring Integration - Channel • EIP name: Point-to-Point Channel • Message consumer: Event-Driven Consumer • A channel that invokes a single subscriber for each sent Message. The invocation will occur on executor's threads. It uses an UnicastingDispatcher with a thread executor. Failover support. <channel id=”executorChannel”> <dispatcher task-executor=”someExecutor”/> </channel> <transformer id="t2" input-channel="executorChannel" output-channel="outputChannel" ref="myTransformerBean"/>
  • 14. EIP with Spring Integration - Channel • EIP name: Publish-Subscribe Channel • Message consumer: Event-Driven Consumer • A channel that sends the Message to each one of its subscribers. The invocation occurs on the sender's thread (if no executor is specified) or on separate threads for each receiver (if an executor is specified). It uses an BroadcastingDispatcher with an optional thread executor. <publish-subscribe-channel id="pubSubChannel" task-executor="someExecutor"/> <transformer id="t1" input-channel="pubSubChannel" output-channel="outputChannel1" ref="myTransformerBean1"/> <transformer id="t2" input-channel="pubSubChannel" output-channel="outputChannel2" ref="myTransformerBean2"/> <filter id="f1" input-channel="pubSubChannel" output-channel="outputChannel3"/>
  • 15. EIP with Spring Integration - Channel • EIP name: Point-to-Point Channel • Message consumer: Polling Consumer • Simple implementation of a message channel. Each Message is placed in a BlockingQueue whose capacity may be specified upon construction. By default, it uses a LinkedBlockingQueue but a MessageGroupQueue might be used to store messages on a persistent context (like a relational database) – basically, using a MessageStore <channel id=”queueChannel”> <queue capacity="25" /> </channel> <channel id=”queueChannel” > <queue message-store="myMessageStore" /> </channel> <jdbc:message-store id="myMessageStore" data-source="mySqlDataSource"/>
  • 16. EIP with Spring Integration - Channel • Sending messages on a channel: @Autowired @Qualifier(“myChannelID”); private DirectChannel channel; public void sendMessage(String msgPayload) { final MessagingTemplate mt = new MessagingTemplate(); final Message<String> msg = MessageBuilder.withPayload(msgPayload).build(); mt.send(channel, msg); }
  • 17. EIP with SI – Polling Consumer • Polling consumers: a consumer with a PollableChannel as its input channel • Sync / Async polling consumers • <channel id=”queueChannel”> <queue message-store="myMessageStore" /> </channel> <jdbc:message-store id="myMessageStore" data-source="mySqlDataSource" /> <transformer id="t3" input-channel="queueChannel" output-channel="outputChannel" ref="myTransformerBean"> <poller fixed-rate="10" receive-timeout="60000" task-executor="myTaskExecutor"> <transactional isolation="REPEATABLE_READ" transaction-manager="txManager" propagation="REQUIRED" /> </poller> </transformer>
  • 18. EIP with SI – Event-driven Consumers • Event driven consumers: a consumer with a SubscribableChannel as its input channel • <channel id="directChannel" /> <transformer id="t3" input-channel="directChannel" output-channel="outputChannel" ref="myTransformerBean" />
  • 19. EIP with SI – Channel Adapter • A Channel Adapter is a component that connects a single sender or receiver to a Message Channel. (outside of the sender/receiver; one way communication) • JMS inbound channel adapter: <jms:message-driven-channel-adapter id="jmsIn" destination="requestQueue" channel="jmsInChannel" /> <channel id="jmsInChannel" /> • JMS outbound channel adapter: <channel id="stdinToJmsoutChannel"/> <jms:outbound-channel-adapter id="jmsout" channel="stdinToJmsoutChannel" destination="requestQueue"/> • Predefined channel adapters: JMS, AMQP, JDBC, JPA, Mongo, Redis, FTP, Twitter
  • 20. EIP with SI – Gateways • A Gateway is a Message Endpoint that connects an application that is both a sender and receiver to a Message Channel. (inside the application; two-way communication). • The 'default' gateway allows Java code to call a Spring Integration flow as a Spring service: <gateway id="myGateway" default-request-channel="inputChannel" default-reply-channel="outputChannel" service-interface="fr.pentalog.si.MyGateway"> <method name="process"> <header name="configuredHeader" value="abc"/> </method> </gateway> <channel id="inputChannel" /> <channel id="outputChannel" /> • Async gateways: public interface MyGateway { public String process(String thing, <gateway id="myGateway" default-request-channel="inputChannel" default-reply-channel="outputChannel" service-interface="fr.pentalog.si.MyGatewayy" async-executor="myExecutor"> <method name="process" /> </gateway> • Predefined gateways: – JMS, AMQP, HTTP, Web Services, Redis, JDBC @Header(FileHeaders.FILENAME) String fileName); } public interface MyGateway { public Feature<String> process(String thing, @Header(FileHeaders.FILENAME) String fileName); }
  • 21. EIP with SI – Service Activator • A service activator in Spring Integration simply connects any existing Spring-managed bean to a channel. These Spring service beans may or may not return a result. • <service-activator id="myServiceActivator" input-channel="inputChannel" output-channel="outputChannel" ref="barista" method="prepareHotDrink" /> @Service("barista") public class Barista { @Transactional public Drink prepareHotDrink(OrderItem orderItem) { ... } }
  • 22. EIP with SI – Transformer <transformer input-channel="callCenterOrdersChannel" output-channel="canonicalOrdersChannel" ref="transformer" method="transform"/> <beans:bean id="transformer" class="fr.pentalog.si.CallCenterOrderTransformer" /> public class CallCenterOrderTransformer { public CanonicalOrder transform(CallCenterOrder order) { ...; } } <object-to-json-transformer input-channel="newOrders" output-channel="jsonNewOrders" />
  • 23. EIP with SI – Claim Check <bean id="mongoDbFactory" class="org.springframework.data.mongodb.core.SimpleMongoDbFactory"> … </bean> <bean id="mongoDbMessageStore" class="org.springframework.integration.mongodb.store.MongoDbMessageStore"> <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" /> <constructor-arg name="collectionName" ref="myClaimCheck" /> </bean> <chain input-channel="inputChannel" output-channel="channel2"> <object-to-json-transformer id="orderToJson" /> <claim-check-in id=”claimCheckIn” message-store=”mongoDbMessageStore” /> </chain> <claim-check-out id="claimCheckOut" input-channel="channel2" output-channel="output3" message-store="mongoDbMessageStore"/>
  • 24. EIP with SI – Filter <filter input-channel="inputChannel2" output-channel="outputChannel" discard-channel="discardChannel2" ref="petFilter" method="dogsOnly" /> <beans:bean id="dogsOnly" class="fr.pentalog.fr.PetFilter"/> public class PetFilter { public boolean dogsOnly(String input) { return input.toLowerCase().contains("dog"); } } <filter input-channel="inputChannel2" output-channel="outputChannel" throw-exception-on-rejection="true" ref="petFilter" method="dogsOnly" />
  • 25. EIP with SI – Splitter <channel id="ordersChannel" /> <channel id="itemsChannel" /> <splitter input-channel="ordersChannel" output-channel="itemsChannel" apply-sequence="true" ref="ordersSplitter" method="splitOrder"> </splitter> <beans:bean id="ordersSplitter" class="fr.pentalog.si.OrdersSplitter" /> public class OrdersSplitter { public List<CanonicalItem> splitOrder(CanonicalOrder order) { return null; } } The Splitter adds following headers in Item messages (for an Order with 2 items): {correlationId=d7c96f28-b9b5-1c8b-1881-8d4b09d83c6b, sequenceSize=2, sequenceNumber=1} { correlationId=d7c96f28-b9b5-1c8b-1881-8d4b09d83c6b, sequenceSize=2, sequenceNumber=2}
  • 26. EIP with SI – Aggregator <aggregator input-channel="itemsChannel" output-channel="ordersChannel" ref="itemsAggregator" method="aggregate" message-store="myMessageStore"> </aggregator> <beans:bean id="itemsAggregator" class="fr.pentalog.si.ItemsAggregator" /> public class ItemsAggregator { public CanonicalOrder splitOrder(List<CanonicalItem> items) { ... } } CorrelationId, SequenceSize, SequenceNumber Statefull component - it might use a message store to keep messages upon completion. Correlation Strategy – how to identify thow messages belong to the same group ReleaseStrategy – how to detect that a group of messages is complete Timeouts – time to wait a group of messages upon completion Discard channel – where expired messages will be published Partial Aggregation – if not all expected messages are to come
  • 27. EIP with SI – Router <channel id="itemInputChannel"/> <router id="router1" input-channel="itemInputChannel" ref="orderRouter" method="route" /> <router id="router2" input-channel="itemInputChannel" ref="orderRouter" method="route"> <mapping value="widget" channel="widgetItemOrderChannel" /> <mapping value="gadget" channel="gadgetItemOrderChannel" /> </router> <beans:bean class="fr.pentalog.si.OrderRouter"/> public class OrderRouter { public String route(CanonicalOrderItem order) { ... } }
  • 28. Spring Integration – Error Handling Default channels: errorChannel used internally for sending error messages and may be overridden with a custom configuration nullChannel acts like /dev/null, simply logging any Message sent to it at DEBUG level and returning immediately
  • 31. Study resources Spring Integration in Action – written by SI's creators Enterprise Integration Patterns
  • 32.
  • 33. Please fill the online evaluation form after event [Enterprise Integration Patterns with Spring Integration] [Mihalache Catalin] [Pentalog] [25th of October 2014]