SlideShare a Scribd company logo
1 of 33
Spring Integration
Zülfikar Karakaya
• EIP + dependency injection + method invocation
• event driven architecture
• low coupling and high cohesion
• pipes-and-filters architectural design
intra-
application
inter
application
Two areas of focus for Spring Integration
• lightweight intra-application messaging
• flexible interapplication integration
The Spring Integration 2.0 distribution
includes support for the following adapters
Filesystem, FTP, or Secured File Transfer Protocol (SFTP)
User Datagram Protocol (UDP)
Transmission Control Protocol (TCP)
HTTP (Representational State Transfer [REST])
Web services (SOAP)
Mail (POP3 or IMAP for receiving, SMTP for sending)
Java Message Service (JMS)
Java Database Connectivity (JDBC)
Java Management Extensions (JMX)
Remote Method Invocation (RMI)
Really Simple Syndication (RSS) feeds
Twitter
Extensible Messaging and Presence Protocol (XMPP)
channel adapters (unidirectional) or
gateways (bidirectional)
three base enterprise integration patterns
message, message channel, and message endpoint
The message’s payload may be XML, a simple string, or a primary
key referencing a record in a database
Messages can have different functions. For example, a Command Message tells the
receiver to do something, an Event Message notifies the receiver
that something has happened, and a Document Message transfers some data from
the sender to the receiver.
The Message!
Message Channels
• connection between multiple endpoints
• how and where a message is delivered
• key enabler for loose coupling
• can be categorized as
– according to the handoff type, synchronous or asynchronous
– according to the delivery type,
• point-to-point (should include support for load balancing and
failover)
• publish-subscribe (require failure-handling patterns)
• channel adapters
• messaging gateways
• service activators
Message Endpoints
• Message endpoints are the components that actually do something with the
message.
• Message endpoints basically provide the connections between functional services
and the messaging framework.
• A message can leave the channel successfully only by being consumed by an
endpoint, and a message can enter the channel only by being produced by an
endpoint.
CHANNEL ADAPTER
• Connects an application to the messaging system.
• Channel adapter is placed at the beginning and the end of a
unidirectional message flow.
• Many different kinds of channel adapters exist, ranging from a
method-invoking channel adapter to a web service channel adapter.
MESSAGING GATEWAY
Outbound gateways can be used for invoking web services and for
synchronous
request-reply interactions over JMS
SERVICE ACTIVATOR
• is a component that invokes a service based on an incoming
message and sends an outbound message based on the return
value of this service invocation.
• in Spring Integration, the definition is constrained to local method
calls.
• a service activator as a method-invoking outbound gateway.
ROUTER
• determines the next channel a message should be sent to based on
the incoming message.
• can be useful to send messages with different payloads to different,
specialized consumers (Content-Based Router).
SPLITTER
• A Splitter is useful whenever the act of processing message content
can be split into multiple steps and executed by different
consumers at the same time.
• An Aggregator waits for a group of correlated messages and
merges them together when the group is complete.
• A splitter and an aggregator are often used in a symmetric setup,
where some work is done in parallel after a splitter, and the
aggregated result is sent back to the upstream gateway.
AGGREGATOR
<splitter input-channel="orders"
output-channel="items"/>
<aggregator input-channel="processedItems"
release-strategy="orderCompletionChecker"
output-channel="processedOrders"/>
• Strategy Method pattern
• Visit www.springframework.org/schema/integration to explore Spring
Integration’s various XML schema namespace configurations.
a simple JMS example
public interface MessageListener {
void onMessage(Message message);
}
<jms:listener-container>
<jms:listener destination="someDestination"
ref="someListenerImplementsJMSMessageListener" />
</jms:listener-container>
public class HelloService {
public String sayHello(String name) {...}
}
<jms:listener-container>
<jms:listener destination="helloRequests" ref="helloService"
method="sayHello" />
</jms:listener-container>
<bean id="helloService" class="example.HelloService" />
JMS default message
listener interface,
no return value
a custom method with
return value,
no scheduling
schedule a file poller
Runnable task = new Runnable() {
public void run() {
File file = filePoller.poll();
if (file != null) {
fileProcessor.process(file);
}
}
};
long initialDelay = 0;
long rate = 60;
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(5);
scheduler.scheduleAtFixedRate(task, initialDelay, rate,TimeUnit.SECONDS);
<task:scheduled-tasks scheduler="myScheduler">
<task:scheduled ref="filePoller" method="poll"fixed-rate="60000" />
</task:scheduled-tasks>
<task:scheduler id="myScheduler" pool-size="5" />
Scheduling a task
programmatically
Scheduling a task with Spring
Spring Integration way
message listener + method invoker + task scheduler
<file:inbound-channel-adapter directory="/tmp/example"
channel="files">
<poller max-messages-per-poll="10"
cron="0 * 9-17 * * MON-FRI"/>
</file:inbound-channel-adapter>
<service-activator input-channel="files" ref="helloService"
method="sayHello"/>
JMS cons
dependency on the JMS API
this inhibits testing and also pollutes the business logic
Light-weight with Spring only, without spring an EJB container required
with version 2.0, Spring introduced its own MessageListener containers as a lightweight
alternative
As with message-driven beans, a listener is registered with a certain JMS destination
but with Spring, the listener’s container is a simple object that is itself managed by
Spring.
JMS default message listener has a void return type
That means you can’t easily send a reply message from the listener method’s
implementation
RPC cons
certain detail about remoting can’t be safely hidden or ignored
serialization
Hello World example
Gateway
Note that the gateway element refers to a service interface. This is similar to
the way the Spring Framework handles remoting.
The caller should only need to be aware of an interface, while the framework
creates a proxy that implements that interface.
The proxy is responsible for handling the underlying concerns such as
serialization and remote invocation, or in this case, message construction and
delivery
Wire Tap
allows you to route messages to a separate location while they are being
forwarded to the ultimate destination.
avoid coupling
<beans:bean id="bookingDao" class="example.SimpleBookingDao" />
<beans:bean id="bookingService" class="example.BookingService">
<beans:constructor-arg ref="bookingDao" />
</beans:bean>
<channel id="mealPreferenceUpdatesChannel" />
<service-activator input-channel="mealPreferenceUpdatesChannel"
output-channel="bookingEnrichedMealUpdates" ref="bookingService"
method="populatePreference" />
<channel id="bookingEnrichedMealUpdates" />
<beans:bean id="updateRequestTransformer"
class="example.MealPreferenceRequestTransformer" />
<service-activator input-channel="bookingEnrichedMealUpdates"
output-channel="xmlMealUpdates" ref="updateRequestTransformer"
method="buildMealPreferenceUpdateRequest" />
<channel id="xmlMealUpdates" />
<ws:outbound-gateway uri="http://example.com/mealupdates"
request-channel="xmlMealUpdates" />
method invocations with message
passing over channels
Reducing coupling is one of the
main concerns when integrating
applications
Event-driven architecture (EDA) is an architectural pattern in which complex applications
are broken down into a set of components or services that interact via events
Where events are communicated via channels that can act as buffers in
periods of high throughput, such a system can be described as having a staged event driven
architecture (SEDA). SEDA-based systems generally respond better to significant
spikes in load than do standard multithreaded applications and are also easier to
configure at runtime, for example, by modifying the number of consumers processing
a certain event type. This allows for optimizations based on the actual requirements of
the application, which in turn provides a better usage experience
Spring Integration provides the building blocks to create both EDA and SEDA applications.
Event-Driven Consumer pattern, but here the consumer is consuming messages rather
than events - it’s just that the consumption is triggered by the event of a message
becoming available.
Event driven architecture
Synchronous and asynchronous communication compared
Traditionally, the integration between enterprise
applications is based on message-driven, asynchronous mechanisms
<channel id="input" />
<payload-type-router input-channel="input">
<mapping type="example.Order" channel="orders"/>
<mapping type="example.Notification" channel="notifications"/>
</payload-type-router>
<channel id="orders" />
<channel id="notifications" />
<service-activator ref="ordersProcessor"
input-channel="orders" output-channel="results" />
<service-activator ref="notificationsProcessor"
input-channel="notifications" output-channel="results" />
<channel id="results" />
Spring Integration Way
Spring Integration Way
The structure doesn’t seem to tell what
kind of interaction takes place
(is it synchronous
or asynchronous?)
Spring Integration supports both approaches by using two different
types of message channels
DirectChannel (synchronous) and QueueChannel (asynchronous)
Both types of channels are configured using the same <channel/>
element. By default, its behavior is synchronous
If you want to buffer the messages instead of passing them
directly through a channel and to follow an asynchronous approach, you
can use a queue to store them, like this
<channel id="input">
<queue capacity="10"/>
</channel>
Spring Integration Way
Message (Revisited)
public interface Message<T> {
MessageHeaders getHeaders();
T getPayload();
}
public final class MessageHeaders
implements Map<String, Object>, Serializable {
/* implementation omitted */
}
message headers are immutable
to avoid issues with concurrency
Channels
public interface MessageChannel {
boolean send(Message<?> message);
boolean send(Message<?> message, long timeout);
}
it provides
no methods for receiving messages
Channels
public interface SubscribableChannel extends MessageChannel {
boolean subscribe(MessageHandler handler);
boolean unsubscribe(MessageHandler handler);
}
I’ll let you know when I’ve got something!
Do you have any messages for me?
public interface PollableChannel extends MessageChannel {
Message<?> receive();
Message<?> receive(long timeout);
}
Selecting right channel for the job
In Spring Integration, the default channels are
SubscribableChannels, and the message
transmission is synchronous.
So there is one thread and single transaction here
<channel id="bookingConfirmationRequests"/>
<service-activator input-channel="bookingConfirmationRequests"
output-channel="chargedBookings"
ref="billForBookingService" />
<channel id="chargedBookings" />
<service-activator input-channel="chargedBookings"
output-channel="emailConfirmationRequests"
ref="seatAvailabilityService" />
<channel id="emailConfirmationRequests" />
<outbound-channel-adapter channel="emailConfirmationRequests"
ref="emailConfirmationService" />
Email is slow and our servers are unreliable
<channel id="emailConfirmationRequests">
<queue />
</channel>
what if you need to connect one producer
with not just one, but two (or more) consumers?
Telling everyone who needs to know that a booking occured
<service-activator input-channel="chargedBookings"
output-channel="emailConfirmationRequests"
ref="seatAvailabilityService" />
<publish-subscribe-channel id="completedBookings" />
<bridge input-channel="completedBookings"
output-channel="emailConfirmationRequests" />
<channel id="emailConfirmationRequests">
<queue />
</channel>
Some customers are more equal than others
<channel id="bookingConfirmationRequests">
<priority-queue comparator="customerPriorityComparator" />
</channel>
this causes the framework to instantiate an instance of PriorityChannel
you can provide an instance of a class implementing
Comparator<Message<?>>
Endpoints
• Polling or event-driven
• Inbound or outbound
• Unidirectional or bidirectional
• Internal or external
References
Spring Integration in Action,
MARK FISHER, JONAS PARTNER, MARIUS BOGOEVICI, IWEIN FULD
Spring Integration
Zülfikar Karakaya

More Related Content

What's hot

API : l'architecture REST
API : l'architecture RESTAPI : l'architecture REST
API : l'architecture RESTFadel Chafai
 
JSON-LD: JSON for the Social Web
JSON-LD: JSON for the Social WebJSON-LD: JSON for the Social Web
JSON-LD: JSON for the Social WebGregg Kellogg
 
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...LF_APIStrat
 
Asynchronous Programming at Netflix
Asynchronous Programming at NetflixAsynchronous Programming at Netflix
Asynchronous Programming at NetflixC4Media
 
Workshop spring session 2 - La persistance au sein des applications Java
Workshop spring   session 2 - La persistance au sein des applications JavaWorkshop spring   session 2 - La persistance au sein des applications Java
Workshop spring session 2 - La persistance au sein des applications JavaAntoine Rey
 
JMS - Java Messaging Service
JMS - Java Messaging ServiceJMS - Java Messaging Service
JMS - Java Messaging ServicePeter R. Egli
 
Kotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is comingKotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is comingKirill Rozov
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraintInviqa
 
Data Driven Application with GraphQL and AWS App Sync
Data Driven Application with GraphQL and AWS App SyncData Driven Application with GraphQL and AWS App Sync
Data Driven Application with GraphQL and AWS App SyncAmazon Web Services
 
Data Ingest Self Service and Management using Nifi and Kafka
Data Ingest Self Service and Management using Nifi and KafkaData Ingest Self Service and Management using Nifi and Kafka
Data Ingest Self Service and Management using Nifi and KafkaDataWorks Summit
 
Apache Drill: Building Highly Flexible, High Performance Query Engines by M.C...
Apache Drill: Building Highly Flexible, High Performance Query Engines by M.C...Apache Drill: Building Highly Flexible, High Performance Query Engines by M.C...
Apache Drill: Building Highly Flexible, High Performance Query Engines by M.C...The Hive
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache CamelClaus Ibsen
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQKnoldus Inc.
 
Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpaStaples
 
Session 8 - Creating Data Processing Services | Train the Trainers Program
Session 8 - Creating Data Processing Services | Train the Trainers ProgramSession 8 - Creating Data Processing Services | Train the Trainers Program
Session 8 - Creating Data Processing Services | Train the Trainers ProgramFIWARE
 

What's hot (20)

API : l'architecture REST
API : l'architecture RESTAPI : l'architecture REST
API : l'architecture REST
 
Windows Azure Service Bus
Windows Azure Service BusWindows Azure Service Bus
Windows Azure Service Bus
 
Completable future
Completable futureCompletable future
Completable future
 
JSON-LD: JSON for the Social Web
JSON-LD: JSON for the Social WebJSON-LD: JSON for the Social Web
JSON-LD: JSON for the Social Web
 
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
LF_APIStrat17_Creating Communication Applications using the Asterisk RESTFul ...
 
Asynchronous Programming at Netflix
Asynchronous Programming at NetflixAsynchronous Programming at Netflix
Asynchronous Programming at Netflix
 
Json Web Token - JWT
Json Web Token - JWTJson Web Token - JWT
Json Web Token - JWT
 
Workshop spring session 2 - La persistance au sein des applications Java
Workshop spring   session 2 - La persistance au sein des applications JavaWorkshop spring   session 2 - La persistance au sein des applications Java
Workshop spring session 2 - La persistance au sein des applications Java
 
JMS - Java Messaging Service
JMS - Java Messaging ServiceJMS - Java Messaging Service
JMS - Java Messaging Service
 
Kotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is comingKotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is coming
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraint
 
Data Driven Application with GraphQL and AWS App Sync
Data Driven Application with GraphQL and AWS App SyncData Driven Application with GraphQL and AWS App Sync
Data Driven Application with GraphQL and AWS App Sync
 
Data Ingest Self Service and Management using Nifi and Kafka
Data Ingest Self Service and Management using Nifi and KafkaData Ingest Self Service and Management using Nifi and Kafka
Data Ingest Self Service and Management using Nifi and Kafka
 
Apache Drill: Building Highly Flexible, High Performance Query Engines by M.C...
Apache Drill: Building Highly Flexible, High Performance Query Engines by M.C...Apache Drill: Building Highly Flexible, High Performance Query Engines by M.C...
Apache Drill: Building Highly Flexible, High Performance Query Engines by M.C...
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQ
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpa
 
Session 8 - Creating Data Processing Services | Train the Trainers Program
Session 8 - Creating Data Processing Services | Train the Trainers ProgramSession 8 - Creating Data Processing Services | Train the Trainers Program
Session 8 - Creating Data Processing Services | Train the Trainers Program
 
Rest API
Rest APIRest API
Rest API
 

Similar to Spring integration

quickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationquickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationjorgesimao71
 
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
 
Messaging with Spring Integration
Messaging with Spring IntegrationMessaging with Spring Integration
Messaging with Spring IntegrationVadim Mikhnevych
 
Peoplesoft PIA architecture
Peoplesoft PIA architecturePeoplesoft PIA architecture
Peoplesoft PIA architectureAmit rai Raaz
 
1480-techintrotoiib-150224130001-conversion-gate01.pptx
1480-techintrotoiib-150224130001-conversion-gate01.pptx1480-techintrotoiib-150224130001-conversion-gate01.pptx
1480-techintrotoiib-150224130001-conversion-gate01.pptxBalakoteswaraReddyM
 
The Grouping of Files in Allocation of Job Using Server Scheduling In Load Ba...
The Grouping of Files in Allocation of Job Using Server Scheduling In Load Ba...The Grouping of Files in Allocation of Job Using Server Scheduling In Load Ba...
The Grouping of Files in Allocation of Job Using Server Scheduling In Load Ba...iosrjce
 
Integration Patterns With Spring integration
Integration Patterns With Spring integrationIntegration Patterns With Spring integration
Integration Patterns With Spring integrationEldad Dor
 
Cs556 section2
Cs556 section2Cs556 section2
Cs556 section2farshad33
 
Application server
Application serverApplication server
Application servernava rathna
 
Telpro Integration
Telpro IntegrationTelpro Integration
Telpro IntegrationRex Sheridan
 
Oracle advanced queuing
Oracle advanced queuingOracle advanced queuing
Oracle advanced queuingGurpreet singh
 
Task communication
Task communicationTask communication
Task communication1jayanti
 
The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...Lucas Jellema
 
Introduction to requirement of microservices
Introduction to requirement of microservicesIntroduction to requirement of microservices
Introduction to requirement of microservicesAvik Das
 
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...cscpconf
 
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...csandit
 
Relevant updated data retrieval architectural model for continous text extrac...
Relevant updated data retrieval architectural model for continous text extrac...Relevant updated data retrieval architectural model for continous text extrac...
Relevant updated data retrieval architectural model for continous text extrac...csandit
 

Similar to Spring integration (20)

quickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationquickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integration
 
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
 
Messaging with Spring Integration
Messaging with Spring IntegrationMessaging with Spring Integration
Messaging with Spring Integration
 
Peoplesoft PIA architecture
Peoplesoft PIA architecturePeoplesoft PIA architecture
Peoplesoft PIA architecture
 
1480-techintrotoiib-150224130001-conversion-gate01.pptx
1480-techintrotoiib-150224130001-conversion-gate01.pptx1480-techintrotoiib-150224130001-conversion-gate01.pptx
1480-techintrotoiib-150224130001-conversion-gate01.pptx
 
J017367075
J017367075J017367075
J017367075
 
The Grouping of Files in Allocation of Job Using Server Scheduling In Load Ba...
The Grouping of Files in Allocation of Job Using Server Scheduling In Load Ba...The Grouping of Files in Allocation of Job Using Server Scheduling In Load Ba...
The Grouping of Files in Allocation of Job Using Server Scheduling In Load Ba...
 
Integration Patterns With Spring integration
Integration Patterns With Spring integrationIntegration Patterns With Spring integration
Integration Patterns With Spring integration
 
Cs556 section2
Cs556 section2Cs556 section2
Cs556 section2
 
Application server
Application serverApplication server
Application server
 
Telpro Integration
Telpro IntegrationTelpro Integration
Telpro Integration
 
Oracle advanced queuing
Oracle advanced queuingOracle advanced queuing
Oracle advanced queuing
 
Task communication
Task communicationTask communication
Task communication
 
Components of client server application
Components of client server applicationComponents of client server application
Components of client server application
 
The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
 
SOFTWARE COMPUTING
SOFTWARE COMPUTINGSOFTWARE COMPUTING
SOFTWARE COMPUTING
 
Introduction to requirement of microservices
Introduction to requirement of microservicesIntroduction to requirement of microservices
Introduction to requirement of microservices
 
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...
 
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...
RELEVANT UPDATED DATA RETRIEVAL ARCHITECTURAL MODEL FOR CONTINUOUS TEXT EXTRA...
 
Relevant updated data retrieval architectural model for continous text extrac...
Relevant updated data retrieval architectural model for continous text extrac...Relevant updated data retrieval architectural model for continous text extrac...
Relevant updated data retrieval architectural model for continous text extrac...
 

Recently uploaded

2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 

Recently uploaded (20)

2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 

Spring integration

  • 2. • EIP + dependency injection + method invocation • event driven architecture • low coupling and high cohesion • pipes-and-filters architectural design
  • 3. intra- application inter application Two areas of focus for Spring Integration • lightweight intra-application messaging • flexible interapplication integration
  • 4. The Spring Integration 2.0 distribution includes support for the following adapters Filesystem, FTP, or Secured File Transfer Protocol (SFTP) User Datagram Protocol (UDP) Transmission Control Protocol (TCP) HTTP (Representational State Transfer [REST]) Web services (SOAP) Mail (POP3 or IMAP for receiving, SMTP for sending) Java Message Service (JMS) Java Database Connectivity (JDBC) Java Management Extensions (JMX) Remote Method Invocation (RMI) Really Simple Syndication (RSS) feeds Twitter Extensible Messaging and Presence Protocol (XMPP) channel adapters (unidirectional) or gateways (bidirectional)
  • 5. three base enterprise integration patterns message, message channel, and message endpoint
  • 6. The message’s payload may be XML, a simple string, or a primary key referencing a record in a database Messages can have different functions. For example, a Command Message tells the receiver to do something, an Event Message notifies the receiver that something has happened, and a Document Message transfers some data from the sender to the receiver. The Message!
  • 7. Message Channels • connection between multiple endpoints • how and where a message is delivered • key enabler for loose coupling • can be categorized as – according to the handoff type, synchronous or asynchronous – according to the delivery type, • point-to-point (should include support for load balancing and failover) • publish-subscribe (require failure-handling patterns)
  • 8. • channel adapters • messaging gateways • service activators Message Endpoints • Message endpoints are the components that actually do something with the message. • Message endpoints basically provide the connections between functional services and the messaging framework. • A message can leave the channel successfully only by being consumed by an endpoint, and a message can enter the channel only by being produced by an endpoint.
  • 9. CHANNEL ADAPTER • Connects an application to the messaging system. • Channel adapter is placed at the beginning and the end of a unidirectional message flow. • Many different kinds of channel adapters exist, ranging from a method-invoking channel adapter to a web service channel adapter.
  • 10. MESSAGING GATEWAY Outbound gateways can be used for invoking web services and for synchronous request-reply interactions over JMS
  • 11. SERVICE ACTIVATOR • is a component that invokes a service based on an incoming message and sends an outbound message based on the return value of this service invocation. • in Spring Integration, the definition is constrained to local method calls. • a service activator as a method-invoking outbound gateway.
  • 12. ROUTER • determines the next channel a message should be sent to based on the incoming message. • can be useful to send messages with different payloads to different, specialized consumers (Content-Based Router).
  • 13. SPLITTER • A Splitter is useful whenever the act of processing message content can be split into multiple steps and executed by different consumers at the same time. • An Aggregator waits for a group of correlated messages and merges them together when the group is complete. • A splitter and an aggregator are often used in a symmetric setup, where some work is done in parallel after a splitter, and the aggregated result is sent back to the upstream gateway. AGGREGATOR
  • 14. <splitter input-channel="orders" output-channel="items"/> <aggregator input-channel="processedItems" release-strategy="orderCompletionChecker" output-channel="processedOrders"/> • Strategy Method pattern • Visit www.springframework.org/schema/integration to explore Spring Integration’s various XML schema namespace configurations.
  • 15. a simple JMS example public interface MessageListener { void onMessage(Message message); } <jms:listener-container> <jms:listener destination="someDestination" ref="someListenerImplementsJMSMessageListener" /> </jms:listener-container> public class HelloService { public String sayHello(String name) {...} } <jms:listener-container> <jms:listener destination="helloRequests" ref="helloService" method="sayHello" /> </jms:listener-container> <bean id="helloService" class="example.HelloService" /> JMS default message listener interface, no return value a custom method with return value, no scheduling
  • 16. schedule a file poller Runnable task = new Runnable() { public void run() { File file = filePoller.poll(); if (file != null) { fileProcessor.process(file); } } }; long initialDelay = 0; long rate = 60; ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(5); scheduler.scheduleAtFixedRate(task, initialDelay, rate,TimeUnit.SECONDS); <task:scheduled-tasks scheduler="myScheduler"> <task:scheduled ref="filePoller" method="poll"fixed-rate="60000" /> </task:scheduled-tasks> <task:scheduler id="myScheduler" pool-size="5" /> Scheduling a task programmatically Scheduling a task with Spring
  • 17. Spring Integration way message listener + method invoker + task scheduler <file:inbound-channel-adapter directory="/tmp/example" channel="files"> <poller max-messages-per-poll="10" cron="0 * 9-17 * * MON-FRI"/> </file:inbound-channel-adapter> <service-activator input-channel="files" ref="helloService" method="sayHello"/>
  • 18. JMS cons dependency on the JMS API this inhibits testing and also pollutes the business logic Light-weight with Spring only, without spring an EJB container required with version 2.0, Spring introduced its own MessageListener containers as a lightweight alternative As with message-driven beans, a listener is registered with a certain JMS destination but with Spring, the listener’s container is a simple object that is itself managed by Spring. JMS default message listener has a void return type That means you can’t easily send a reply message from the listener method’s implementation RPC cons certain detail about remoting can’t be safely hidden or ignored serialization
  • 19. Hello World example Gateway Note that the gateway element refers to a service interface. This is similar to the way the Spring Framework handles remoting. The caller should only need to be aware of an interface, while the framework creates a proxy that implements that interface. The proxy is responsible for handling the underlying concerns such as serialization and remote invocation, or in this case, message construction and delivery Wire Tap allows you to route messages to a separate location while they are being forwarded to the ultimate destination.
  • 20. avoid coupling <beans:bean id="bookingDao" class="example.SimpleBookingDao" /> <beans:bean id="bookingService" class="example.BookingService"> <beans:constructor-arg ref="bookingDao" /> </beans:bean> <channel id="mealPreferenceUpdatesChannel" /> <service-activator input-channel="mealPreferenceUpdatesChannel" output-channel="bookingEnrichedMealUpdates" ref="bookingService" method="populatePreference" /> <channel id="bookingEnrichedMealUpdates" /> <beans:bean id="updateRequestTransformer" class="example.MealPreferenceRequestTransformer" /> <service-activator input-channel="bookingEnrichedMealUpdates" output-channel="xmlMealUpdates" ref="updateRequestTransformer" method="buildMealPreferenceUpdateRequest" /> <channel id="xmlMealUpdates" /> <ws:outbound-gateway uri="http://example.com/mealupdates" request-channel="xmlMealUpdates" /> method invocations with message passing over channels Reducing coupling is one of the main concerns when integrating applications
  • 21. Event-driven architecture (EDA) is an architectural pattern in which complex applications are broken down into a set of components or services that interact via events Where events are communicated via channels that can act as buffers in periods of high throughput, such a system can be described as having a staged event driven architecture (SEDA). SEDA-based systems generally respond better to significant spikes in load than do standard multithreaded applications and are also easier to configure at runtime, for example, by modifying the number of consumers processing a certain event type. This allows for optimizations based on the actual requirements of the application, which in turn provides a better usage experience Spring Integration provides the building blocks to create both EDA and SEDA applications. Event-Driven Consumer pattern, but here the consumer is consuming messages rather than events - it’s just that the consumption is triggered by the event of a message becoming available. Event driven architecture
  • 22. Synchronous and asynchronous communication compared Traditionally, the integration between enterprise applications is based on message-driven, asynchronous mechanisms
  • 23. <channel id="input" /> <payload-type-router input-channel="input"> <mapping type="example.Order" channel="orders"/> <mapping type="example.Notification" channel="notifications"/> </payload-type-router> <channel id="orders" /> <channel id="notifications" /> <service-activator ref="ordersProcessor" input-channel="orders" output-channel="results" /> <service-activator ref="notificationsProcessor" input-channel="notifications" output-channel="results" /> <channel id="results" /> Spring Integration Way
  • 24. Spring Integration Way The structure doesn’t seem to tell what kind of interaction takes place (is it synchronous or asynchronous?)
  • 25. Spring Integration supports both approaches by using two different types of message channels DirectChannel (synchronous) and QueueChannel (asynchronous) Both types of channels are configured using the same <channel/> element. By default, its behavior is synchronous If you want to buffer the messages instead of passing them directly through a channel and to follow an asynchronous approach, you can use a queue to store them, like this <channel id="input"> <queue capacity="10"/> </channel> Spring Integration Way
  • 26. Message (Revisited) public interface Message<T> { MessageHeaders getHeaders(); T getPayload(); } public final class MessageHeaders implements Map<String, Object>, Serializable { /* implementation omitted */ } message headers are immutable to avoid issues with concurrency
  • 27. Channels public interface MessageChannel { boolean send(Message<?> message); boolean send(Message<?> message, long timeout); } it provides no methods for receiving messages
  • 28. Channels public interface SubscribableChannel extends MessageChannel { boolean subscribe(MessageHandler handler); boolean unsubscribe(MessageHandler handler); } I’ll let you know when I’ve got something! Do you have any messages for me? public interface PollableChannel extends MessageChannel { Message<?> receive(); Message<?> receive(long timeout); }
  • 29. Selecting right channel for the job In Spring Integration, the default channels are SubscribableChannels, and the message transmission is synchronous. So there is one thread and single transaction here <channel id="bookingConfirmationRequests"/> <service-activator input-channel="bookingConfirmationRequests" output-channel="chargedBookings" ref="billForBookingService" /> <channel id="chargedBookings" /> <service-activator input-channel="chargedBookings" output-channel="emailConfirmationRequests" ref="seatAvailabilityService" /> <channel id="emailConfirmationRequests" /> <outbound-channel-adapter channel="emailConfirmationRequests" ref="emailConfirmationService" />
  • 30. Email is slow and our servers are unreliable <channel id="emailConfirmationRequests"> <queue /> </channel> what if you need to connect one producer with not just one, but two (or more) consumers? Telling everyone who needs to know that a booking occured <service-activator input-channel="chargedBookings" output-channel="emailConfirmationRequests" ref="seatAvailabilityService" /> <publish-subscribe-channel id="completedBookings" /> <bridge input-channel="completedBookings" output-channel="emailConfirmationRequests" /> <channel id="emailConfirmationRequests"> <queue /> </channel>
  • 31. Some customers are more equal than others <channel id="bookingConfirmationRequests"> <priority-queue comparator="customerPriorityComparator" /> </channel> this causes the framework to instantiate an instance of PriorityChannel you can provide an instance of a class implementing Comparator<Message<?>>
  • 32. Endpoints • Polling or event-driven • Inbound or outbound • Unidirectional or bidirectional • Internal or external
  • 33. References Spring Integration in Action, MARK FISHER, JONAS PARTNER, MARIUS BOGOEVICI, IWEIN FULD Spring Integration Zülfikar Karakaya