SlideShare a Scribd company logo
Spring Integration
as Integration Patterns
provider
Blynov Viacheslav
Dnepropetrovsk
24 June 2014
224 June 2014
3
Spring Integration Goals
 Provide a simple model for implementing complex enterprise integration
solutions.
 Facilitate asynchronous, message-driven behavior within a Spring-based
application.
 Promote intuitive, incremental adoption for existing Spring users.
Spring Integration Introduction
24 June 2014
4
Spring Integration Features
 Implementation of most of the Enterprise Integration Patterns
– Endpoint
– Channel
– Aggregator
– Filter
– …
 Integration with External Systems
– REST/HTTP
– FTP
– Twitter
– JMS
– …
 The framework has extensive JMX support
– exposing framework components as MBeans
– adapters to obtain attributes from MBeans, invoke operations, send/receive notifications
Spring Integration Introduction
24 June 2014
5
Spring Integration Endpoints
 AMQP
 Spring Application Events
 File System
 FTP
 Gemfire
 HTTP/REST
 JDBC
 JMX
 JPA
 Mail
 MongoDB
 Redis
 RMI
 TCP
 Twitter
 UDP
 XMPP
Spring Integration Introduction
24 June 2014
624 June 2014
Main Components
7
Main Components
 Message
 Message Channel
 Message Endpoint
– Transformer
– Filter
– Router
– Splitter
– Aggregator
– Service Activator
– Channel Adapter
– Gateway
Spring Integration Main Components
24 June 2014
8
Spring Integration Main Components
24 June 2014
Message
 Message is a generic wrapper
for any Java object combined
with metadata used by the
framework while handling that
object
9
Spring Integration Main Components
24 June 2014
Message Channel
 Point-To-Point Channel
 Publish/Subscribe Channel
 Pollable Channels
 Message-Driven Channels
10
Spring Integration Main Components
24 June 2014
Message Endpoint
Encapsulates communication-
specific details:
 converts/extracts business data
to/from message
 sends/receives messages
to/from message channel
11
Spring Integration Main Components
24 June 2014
Transformer
 Message Transformer is
responsible for converting a
Message's content or structure
and returning the modified
Message
12
Spring Integration Main Components
24 June 2014
Filter
 Message Filter determines
whether a Message should be
passed to an output channel at
all
13
Spring Integration Main Components
24 June 2014
Splitter
 Splitter is another type of
Message Endpoint whose
responsibility is to accept a
Message from its input channel,
split that Message into multiple
Messages, and then send each
of those to its output channel.
14
Spring Integration Main Components
24 June 2014
Service Activator
Service Activator is a generic endpoint for connecting a service
instance to the messaging system.
The input Message Channel must be configured, and if the service
method to be invoked is capable of returning a value, an output
Message Channel may also be provided.
15
Spring Integration Main Components
24 June 2014
Gateway
The Gateway encapsulates messaging-specific code (e.g.,
the code required to send or receive a message) and separates it
from the rest of the application code. The Messaging
Gateway exposes a business function to the rest of the application
so that instead of requiring the application to set properties like
Message.
1624 June 2014
Example
17
Task
 We receive JMS messages with some CompoundObject in JSON format
 CompoundObject is-a list of some Objects
 We need to extract all Objects from CompoundObject and save them to database
(possibly performing some other business logic)
 Those Objects which are considered “good” (verified against some rule) should
be sent via JMS to another queue in JSON format
Spring Integration Example
24 June 2014
18
Spring Integration Example
24 June 2014
 We need to add the following dependencies in pom.xml
19
Spring Integration Example
24 June 2014
 Specify JMS connection factory
20
Spring Integration Example
24 June 2014
 Configure Spring Integration context
21
Spring Integration Example
24 June 2014
 Configure Spring Integration context
CompObjectDTO parseCompoundObject(String
payload)
22
Spring Integration Example
24 June 2014
 Configure Spring Integration context
CompObjectDTO parseCompoundObject(String
payload)
List<ObjectDTO> splitCompound(CompObjectDTO dto)
23
Spring Integration Example
24 June 2014
 Configure Spring Integration context
CompObjectDTO parseCompoundObject(String
payload)
List<ObjectDTO> splitCompound(CompObjectDTO dto)
Object convertToEntity(ObjectDTO dto)
24
Spring Integration Example
24 June 2014
 Configure Spring Integration context
CompObjectDTO parseCompoundObject(String
payload)
List<ObjectDTO> splitCompound(CompObjectDTO dto)
Object convertToEntity(ObjectDTO dto)
Object saveEntity(Object obj)
25
Spring Integration Example
24 June 2014
 Configure Spring Integration context
CompObjectDTO parseCompoundObject(String
payload)
List<ObjectDTO> splitCompound(CompObjectDTO dto)
Object convertToEntity(ObjectDTO dto)
Object saveEntity(Object obj)
boolean isGoodObject(Object obj)
26
Spring Integration Example
24 June 2014
 Configure Spring Integration context
CompObjectDTO parseCompoundObject(String
payload)
List<ObjectDTO> splitCompound(CompObjectDTO dto)
Object convertToEntity(ObjectDTO dto)
Object saveEntity(Object obj)
boolean isGoodObject(Object obj)
ObjectDTO convertToDTO(Object obj)
27
Spring Integration Example
24 June 2014
 Configure Spring Integration context
CompObjectDTO parseCompoundObject(String
payload)
List<ObjectDTO> splitCompound(CompObjectDTO dto)
Object convertToEntity(ObjectDTO dto)
Object saveEntity(Object obj)
boolean isGoodObject(Object obj)
ObjectDTO convertToDTO(Object obj)
String serializeObjectDTO(ObjectDTO obj)
28
Spring Integration Example
24 June 2014
Receiving messages via HTTP REST
29
Another option: JMS backed message channels
Channel adapter are intended for applications that are integrating with
other external systems. There are cases where both the producer and consumer
for a given JMS Destination are intended to be part of the same application,
running within the same process.
<int-jms:channel id="jmsChannel" queue="exampleQueue"/>
<int-jms:publish-subscribe-channel id="jmsChannel" topic="exampleTopic"/>
 Support of transactions (“transaction-manager” atrribute)
 Support for connection (session, consumer) cache
 Concurrency (number of concurrent sessions/consumers to start for each listener)
Spring Integration Example
24 June 2014
30
Task 2
 An exteranl system feeds us with stream of JSON objects putting them to JMS
queue
 We need to make some calculations (business logic) using these objects in the
order as they come
 Depending on calculationd results we could change the persistent state of our
domain objects
 Incoming objects should be saved to our DB
 Finally, the results of calculation should be sent in JSON format to another JMS
queue
Spring Integration Example
24 June 2014
31
Basic Flow
Spring Integration Example
24 June 2014
Receive objects
Validation
convertion to entity
Calculation
Analyze and save
results
Send to outbound
JMS
Save entities to DB
32
Router
Spring Integration Example
24 June 2014
• Payload Type Router
• Header Value Router
• Recipient List Router
• XPath Router (Part of the XML Module)
• Error Message Exception Type Router
• (Generic) Router
33
Problem
Spring Integration Example
24 June 2014
The incoming messages could arrive very
frequently
34
Aggregator
Spring Integration Example
24 June 2014
• Message Store
• Correlation Strategy (delaults to grouping be MessageHeader.CORRELATION_ID)
• Release Strategy
• Expiration policy
35
Back to task 2: receive and aggregate
Spring Integration Example
24 June 2014
36
Back to task 2: receive and aggregate
Spring Integration Example
24 June 2014
boolean canReleaseMessages(List<IncObject>)
List<IncObject> aggregate(List<IncObject>)
Object getCorrelationKey(IncObject)
37
Back to task 2: routing
Spring Integration Example
24 June 2014
38
Back to task 2: via publish-subscribe channel
Spring Integration Example
24 June 2014
39
Task summary
 Built on the top of other Spring modules (e. g. Spring JMS)
 Every element of the chain – just a simple POJO
 High cohesion
 Easy to cover with unit-tests
 “Convention over configuration” – bean with name “connectionFactory” will be
found automatically
 Change the whole business flow only by configuration
Spring Integration Example
24 June 2014
4024 June 2014
Spring
Integration VS
Apache Camel
41
 Both projects aim to fill similar need: light-weight integration library with full
implementations of EIP
 Apache Camel introduces DSL (Java, Scala, Groovy). Spring Integration - only
XML
 Apache Camel supports longer list of technologies
 Apache Camel offers rich support for both integration and unit-testing. Spring
Integration supports just generic Spring Test
 Apache Camel Community is larger, documentation is better
Spring Integration Spring Integration VS Apache Camel
24 June 2014
42
Apache Camel Java DSL Example
final JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
jaxbDataFormat.setContextPath(“test.ns.oxm");
jaxbDataFormat.setPartClass(“test.ns.oxm.ABSPartnerChangesEventType");
from("activemq:incoming.partner")
.log("log:test.log")
.choice() .when(header("EVENTTYPE").isEqualTo(“TESTVALUE")).to("direct:createPartner“)
.when(header("EVENTTYPE").isEqualTo(“TESTVALUE2")).to("direct:updatePartner");
from("direct:createPartner")
.errorHandler(noErrorHandler())
.unmarshal(jaxbDataFormat)
.beanRef(“partnerChangeHandler", "createPartner");
from("direct:updatePartner")
.errorHandler(noErrorHandler())
.unmarshal(jaxbDataFormat)
.beanRef(“partnerChangeHandler", "updatePartner");
Spring Integration Spring Integration VS Apache Camel
24 June 2014
43
Recent changes
 Spring EL support (3.0.2)
 HTTP request mapping (based on Spring MVC infrastructure) (3.0.2)
 Enhanced support for MongoDB, Redis and JPA (3.0.2)
 @EnableIntegration, @IntegrationComponentScan (4.0.2)
 Requires Spring 4.0 (4.0.2)
Spring Integration Example
24 June 2014
4424 June 2014
Questions?

More Related Content

Similar to «Spring Integration as Integration Patterns Provider»

Lunch Learn - WCF Security
Lunch Learn - WCF SecurityLunch Learn - WCF Security
Lunch Learn - WCF Security
Paul Senatillaka
 
Generic Repository Pattern in MVC3 Application with Entity Framework
Generic Repository Pattern in MVC3 Application with Entity FrameworkGeneric Repository Pattern in MVC3 Application with Entity Framework
Generic Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
 
Olap
OlapOlap
Olap
preksha33
 
Summarization Techniques for Code, Changes, and Testing
Summarization Techniques for Code, Changes, and TestingSummarization Techniques for Code, Changes, and Testing
Summarization Techniques for Code, Changes, and Testing
Sebastiano Panichella
 
class based component.pptx
class based component.pptxclass based component.pptx
class based component.pptx
saikatsamanta49
 
Mulesoftppt
Mulesoftppt Mulesoftppt
Spring andspringboot training
Spring andspringboot trainingSpring andspringboot training
Spring andspringboot training
Mallikarjuna G D
 
Guide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in KotlinGuide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in Kotlin
RapidValue
 
JBPM5 Community Training Course - Module #1 Introduction
JBPM5 Community Training Course - Module #1 IntroductionJBPM5 Community Training Course - Module #1 Introduction
JBPM5 Community Training Course - Module #1 Introduction
Mauricio (Salaboy) Salatino
 
Overview of Mule
Overview of MuleOverview of Mule
Overview of Mule
AbdulImrankhan7
 
Automated Multiplatform Compilation and Validation of a Collaborative Reposit...
Automated Multiplatform Compilation and Validation of a Collaborative Reposit...Automated Multiplatform Compilation and Validation of a Collaborative Reposit...
Automated Multiplatform Compilation and Validation of a Collaborative Reposit...
Ángel Jesús Martínez Bernal
 
Learning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkLearning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFramework
Akhil Mittal
 
Msbi online training
Msbi online trainingMsbi online training
Msbi online training
Divya Shree
 
Experiences with Migration from SPEM 2.0 to Essence 1.0 for the REMICS Method...
Experiences with Migration from SPEM 2.0 to Essence 1.0 for the REMICS Method...Experiences with Migration from SPEM 2.0 to Essence 1.0 for the REMICS Method...
Experiences with Migration from SPEM 2.0 to Essence 1.0 for the REMICS Method...
Brian Elvesæter
 
Dependency injection in Java, from naive to functional
Dependency injection in Java, from naive to functionalDependency injection in Java, from naive to functional
Dependency injection in Java, from naive to functional
Marian Wamsiedel
 
MSBI Online Training in India
MSBI Online Training in IndiaMSBI Online Training in India
MSBI Online Training in India
united global soft
 
MSBI Online Training in Hyderabad
MSBI Online Training in HyderabadMSBI Online Training in Hyderabad
MSBI Online Training in Hyderabad
united global soft
 
JDC2008 - Enterprise Integration and Service Oriented Design
JDC2008 - Enterprise Integration and Service Oriented DesignJDC2008 - Enterprise Integration and Service Oriented Design
JDC2008 - Enterprise Integration and Service Oriented Design
Hossam Karim
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsug
Toshiaki Maki
 
MuleSoft Manchester Meetup #3 slides 31st March 2020
MuleSoft Manchester Meetup #3 slides 31st March 2020MuleSoft Manchester Meetup #3 slides 31st March 2020
MuleSoft Manchester Meetup #3 slides 31st March 2020
Ieva Navickaite
 

Similar to «Spring Integration as Integration Patterns Provider» (20)

Lunch Learn - WCF Security
Lunch Learn - WCF SecurityLunch Learn - WCF Security
Lunch Learn - WCF Security
 
Generic Repository Pattern in MVC3 Application with Entity Framework
Generic Repository Pattern in MVC3 Application with Entity FrameworkGeneric Repository Pattern in MVC3 Application with Entity Framework
Generic Repository Pattern in MVC3 Application with Entity Framework
 
Olap
OlapOlap
Olap
 
Summarization Techniques for Code, Changes, and Testing
Summarization Techniques for Code, Changes, and TestingSummarization Techniques for Code, Changes, and Testing
Summarization Techniques for Code, Changes, and Testing
 
class based component.pptx
class based component.pptxclass based component.pptx
class based component.pptx
 
Mulesoftppt
Mulesoftppt Mulesoftppt
Mulesoftppt
 
Spring andspringboot training
Spring andspringboot trainingSpring andspringboot training
Spring andspringboot training
 
Guide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in KotlinGuide to Generate Extent Report in Kotlin
Guide to Generate Extent Report in Kotlin
 
JBPM5 Community Training Course - Module #1 Introduction
JBPM5 Community Training Course - Module #1 IntroductionJBPM5 Community Training Course - Module #1 Introduction
JBPM5 Community Training Course - Module #1 Introduction
 
Overview of Mule
Overview of MuleOverview of Mule
Overview of Mule
 
Automated Multiplatform Compilation and Validation of a Collaborative Reposit...
Automated Multiplatform Compilation and Validation of a Collaborative Reposit...Automated Multiplatform Compilation and Validation of a Collaborative Reposit...
Automated Multiplatform Compilation and Validation of a Collaborative Reposit...
 
Learning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkLearning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFramework
 
Msbi online training
Msbi online trainingMsbi online training
Msbi online training
 
Experiences with Migration from SPEM 2.0 to Essence 1.0 for the REMICS Method...
Experiences with Migration from SPEM 2.0 to Essence 1.0 for the REMICS Method...Experiences with Migration from SPEM 2.0 to Essence 1.0 for the REMICS Method...
Experiences with Migration from SPEM 2.0 to Essence 1.0 for the REMICS Method...
 
Dependency injection in Java, from naive to functional
Dependency injection in Java, from naive to functionalDependency injection in Java, from naive to functional
Dependency injection in Java, from naive to functional
 
MSBI Online Training in India
MSBI Online Training in IndiaMSBI Online Training in India
MSBI Online Training in India
 
MSBI Online Training in Hyderabad
MSBI Online Training in HyderabadMSBI Online Training in Hyderabad
MSBI Online Training in Hyderabad
 
JDC2008 - Enterprise Integration and Service Oriented Design
JDC2008 - Enterprise Integration and Service Oriented DesignJDC2008 - Enterprise Integration and Service Oriented Design
JDC2008 - Enterprise Integration and Service Oriented Design
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsug
 
MuleSoft Manchester Meetup #3 slides 31st March 2020
MuleSoft Manchester Meetup #3 slides 31st March 2020MuleSoft Manchester Meetup #3 slides 31st March 2020
MuleSoft Manchester Meetup #3 slides 31st March 2020
 

More from IT Weekend

Quality attributes testing. From Architecture to test acceptance
Quality attributes testing. From Architecture to test acceptanceQuality attributes testing. From Architecture to test acceptance
Quality attributes testing. From Architecture to test acceptance
IT Weekend
 
Mobile development for JavaScript developer
Mobile development for JavaScript developerMobile development for JavaScript developer
Mobile development for JavaScript developer
IT Weekend
 
Building an Innovation & Strategy Process
Building an Innovation & Strategy ProcessBuilding an Innovation & Strategy Process
Building an Innovation & Strategy Process
IT Weekend
 
IT Professionals – The Right Time/The Right Place
IT Professionals – The Right Time/The Right PlaceIT Professionals – The Right Time/The Right Place
IT Professionals – The Right Time/The Right Place
IT Weekend
 
Building a Data Driven Organization
Building a Data Driven OrganizationBuilding a Data Driven Organization
Building a Data Driven Organization
IT Weekend
 
7 Tools for the Product Owner
7 Tools for the Product Owner 7 Tools for the Product Owner
7 Tools for the Product Owner
IT Weekend
 
Hacking your Doorbell
Hacking your DoorbellHacking your Doorbell
Hacking your Doorbell
IT Weekend
 
An era of possibilities, a window in time
An era of possibilities, a window in timeAn era of possibilities, a window in time
An era of possibilities, a window in time
IT Weekend
 
Web services automation from sketch
Web services automation from sketchWeb services automation from sketch
Web services automation from sketch
IT Weekend
 
Why Ruby?
Why Ruby? Why Ruby?
Why Ruby?
IT Weekend
 
REST that won't make you cry
REST that won't make you cryREST that won't make you cry
REST that won't make you cry
IT Weekend
 
Как договариваться с начальником и заказчиком: выбираем нужный протокол общения
Как договариваться с начальником и заказчиком: выбираем нужный протокол общенияКак договариваться с начальником и заказчиком: выбираем нужный протокол общения
Как договариваться с начальником и заказчиком: выбираем нужный протокол общения
IT Weekend
 
Обзор программы SAP HANA Startup Focus
Обзор программы SAP HANA Startup FocusОбзор программы SAP HANA Startup Focus
Обзор программы SAP HANA Startup Focus
IT Weekend
 
World of Agile: Kanban
World of Agile: KanbanWorld of Agile: Kanban
World of Agile: Kanban
IT Weekend
 
Risk Management
Risk ManagementRisk Management
Risk Management
IT Weekend
 
Cutting edge of Machine Learning
Cutting edge of Machine LearningCutting edge of Machine Learning
Cutting edge of Machine Learning
IT Weekend
 
Parallel Programming In Modern World .NET Technics
Parallel Programming In Modern World .NET TechnicsParallel Programming In Modern World .NET Technics
Parallel Programming In Modern World .NET Technics
IT Weekend
 
Parallel programming in modern world .net technics shared
Parallel programming in modern world .net technics   sharedParallel programming in modern world .net technics   shared
Parallel programming in modern world .net technics shared
IT Weekend
 
Maximize Effectiveness of Human Capital
Maximize Effectiveness of Human CapitalMaximize Effectiveness of Human Capital
Maximize Effectiveness of Human Capital
IT Weekend
 
“Using C#/.NET – “Controversial Topics & Common Mistakes”
“Using C#/.NET – “Controversial Topics & Common Mistakes”“Using C#/.NET – “Controversial Topics & Common Mistakes”
“Using C#/.NET – “Controversial Topics & Common Mistakes”
IT Weekend
 

More from IT Weekend (20)

Quality attributes testing. From Architecture to test acceptance
Quality attributes testing. From Architecture to test acceptanceQuality attributes testing. From Architecture to test acceptance
Quality attributes testing. From Architecture to test acceptance
 
Mobile development for JavaScript developer
Mobile development for JavaScript developerMobile development for JavaScript developer
Mobile development for JavaScript developer
 
Building an Innovation & Strategy Process
Building an Innovation & Strategy ProcessBuilding an Innovation & Strategy Process
Building an Innovation & Strategy Process
 
IT Professionals – The Right Time/The Right Place
IT Professionals – The Right Time/The Right PlaceIT Professionals – The Right Time/The Right Place
IT Professionals – The Right Time/The Right Place
 
Building a Data Driven Organization
Building a Data Driven OrganizationBuilding a Data Driven Organization
Building a Data Driven Organization
 
7 Tools for the Product Owner
7 Tools for the Product Owner 7 Tools for the Product Owner
7 Tools for the Product Owner
 
Hacking your Doorbell
Hacking your DoorbellHacking your Doorbell
Hacking your Doorbell
 
An era of possibilities, a window in time
An era of possibilities, a window in timeAn era of possibilities, a window in time
An era of possibilities, a window in time
 
Web services automation from sketch
Web services automation from sketchWeb services automation from sketch
Web services automation from sketch
 
Why Ruby?
Why Ruby? Why Ruby?
Why Ruby?
 
REST that won't make you cry
REST that won't make you cryREST that won't make you cry
REST that won't make you cry
 
Как договариваться с начальником и заказчиком: выбираем нужный протокол общения
Как договариваться с начальником и заказчиком: выбираем нужный протокол общенияКак договариваться с начальником и заказчиком: выбираем нужный протокол общения
Как договариваться с начальником и заказчиком: выбираем нужный протокол общения
 
Обзор программы SAP HANA Startup Focus
Обзор программы SAP HANA Startup FocusОбзор программы SAP HANA Startup Focus
Обзор программы SAP HANA Startup Focus
 
World of Agile: Kanban
World of Agile: KanbanWorld of Agile: Kanban
World of Agile: Kanban
 
Risk Management
Risk ManagementRisk Management
Risk Management
 
Cutting edge of Machine Learning
Cutting edge of Machine LearningCutting edge of Machine Learning
Cutting edge of Machine Learning
 
Parallel Programming In Modern World .NET Technics
Parallel Programming In Modern World .NET TechnicsParallel Programming In Modern World .NET Technics
Parallel Programming In Modern World .NET Technics
 
Parallel programming in modern world .net technics shared
Parallel programming in modern world .net technics   sharedParallel programming in modern world .net technics   shared
Parallel programming in modern world .net technics shared
 
Maximize Effectiveness of Human Capital
Maximize Effectiveness of Human CapitalMaximize Effectiveness of Human Capital
Maximize Effectiveness of Human Capital
 
“Using C#/.NET – “Controversial Topics & Common Mistakes”
“Using C#/.NET – “Controversial Topics & Common Mistakes”“Using C#/.NET – “Controversial Topics & Common Mistakes”
“Using C#/.NET – “Controversial Topics & Common Mistakes”
 

Recently uploaded

Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 

Recently uploaded (20)

Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 

«Spring Integration as Integration Patterns Provider»

  • 1. Spring Integration as Integration Patterns provider Blynov Viacheslav Dnepropetrovsk 24 June 2014
  • 3. 3 Spring Integration Goals  Provide a simple model for implementing complex enterprise integration solutions.  Facilitate asynchronous, message-driven behavior within a Spring-based application.  Promote intuitive, incremental adoption for existing Spring users. Spring Integration Introduction 24 June 2014
  • 4. 4 Spring Integration Features  Implementation of most of the Enterprise Integration Patterns – Endpoint – Channel – Aggregator – Filter – …  Integration with External Systems – REST/HTTP – FTP – Twitter – JMS – …  The framework has extensive JMX support – exposing framework components as MBeans – adapters to obtain attributes from MBeans, invoke operations, send/receive notifications Spring Integration Introduction 24 June 2014
  • 5. 5 Spring Integration Endpoints  AMQP  Spring Application Events  File System  FTP  Gemfire  HTTP/REST  JDBC  JMX  JPA  Mail  MongoDB  Redis  RMI  TCP  Twitter  UDP  XMPP Spring Integration Introduction 24 June 2014
  • 6. 624 June 2014 Main Components
  • 7. 7 Main Components  Message  Message Channel  Message Endpoint – Transformer – Filter – Router – Splitter – Aggregator – Service Activator – Channel Adapter – Gateway Spring Integration Main Components 24 June 2014
  • 8. 8 Spring Integration Main Components 24 June 2014 Message  Message is a generic wrapper for any Java object combined with metadata used by the framework while handling that object
  • 9. 9 Spring Integration Main Components 24 June 2014 Message Channel  Point-To-Point Channel  Publish/Subscribe Channel  Pollable Channels  Message-Driven Channels
  • 10. 10 Spring Integration Main Components 24 June 2014 Message Endpoint Encapsulates communication- specific details:  converts/extracts business data to/from message  sends/receives messages to/from message channel
  • 11. 11 Spring Integration Main Components 24 June 2014 Transformer  Message Transformer is responsible for converting a Message's content or structure and returning the modified Message
  • 12. 12 Spring Integration Main Components 24 June 2014 Filter  Message Filter determines whether a Message should be passed to an output channel at all
  • 13. 13 Spring Integration Main Components 24 June 2014 Splitter  Splitter is another type of Message Endpoint whose responsibility is to accept a Message from its input channel, split that Message into multiple Messages, and then send each of those to its output channel.
  • 14. 14 Spring Integration Main Components 24 June 2014 Service Activator Service Activator is a generic endpoint for connecting a service instance to the messaging system. The input Message Channel must be configured, and if the service method to be invoked is capable of returning a value, an output Message Channel may also be provided.
  • 15. 15 Spring Integration Main Components 24 June 2014 Gateway The Gateway encapsulates messaging-specific code (e.g., the code required to send or receive a message) and separates it from the rest of the application code. The Messaging Gateway exposes a business function to the rest of the application so that instead of requiring the application to set properties like Message.
  • 17. 17 Task  We receive JMS messages with some CompoundObject in JSON format  CompoundObject is-a list of some Objects  We need to extract all Objects from CompoundObject and save them to database (possibly performing some other business logic)  Those Objects which are considered “good” (verified against some rule) should be sent via JMS to another queue in JSON format Spring Integration Example 24 June 2014
  • 18. 18 Spring Integration Example 24 June 2014  We need to add the following dependencies in pom.xml
  • 19. 19 Spring Integration Example 24 June 2014  Specify JMS connection factory
  • 20. 20 Spring Integration Example 24 June 2014  Configure Spring Integration context
  • 21. 21 Spring Integration Example 24 June 2014  Configure Spring Integration context CompObjectDTO parseCompoundObject(String payload)
  • 22. 22 Spring Integration Example 24 June 2014  Configure Spring Integration context CompObjectDTO parseCompoundObject(String payload) List<ObjectDTO> splitCompound(CompObjectDTO dto)
  • 23. 23 Spring Integration Example 24 June 2014  Configure Spring Integration context CompObjectDTO parseCompoundObject(String payload) List<ObjectDTO> splitCompound(CompObjectDTO dto) Object convertToEntity(ObjectDTO dto)
  • 24. 24 Spring Integration Example 24 June 2014  Configure Spring Integration context CompObjectDTO parseCompoundObject(String payload) List<ObjectDTO> splitCompound(CompObjectDTO dto) Object convertToEntity(ObjectDTO dto) Object saveEntity(Object obj)
  • 25. 25 Spring Integration Example 24 June 2014  Configure Spring Integration context CompObjectDTO parseCompoundObject(String payload) List<ObjectDTO> splitCompound(CompObjectDTO dto) Object convertToEntity(ObjectDTO dto) Object saveEntity(Object obj) boolean isGoodObject(Object obj)
  • 26. 26 Spring Integration Example 24 June 2014  Configure Spring Integration context CompObjectDTO parseCompoundObject(String payload) List<ObjectDTO> splitCompound(CompObjectDTO dto) Object convertToEntity(ObjectDTO dto) Object saveEntity(Object obj) boolean isGoodObject(Object obj) ObjectDTO convertToDTO(Object obj)
  • 27. 27 Spring Integration Example 24 June 2014  Configure Spring Integration context CompObjectDTO parseCompoundObject(String payload) List<ObjectDTO> splitCompound(CompObjectDTO dto) Object convertToEntity(ObjectDTO dto) Object saveEntity(Object obj) boolean isGoodObject(Object obj) ObjectDTO convertToDTO(Object obj) String serializeObjectDTO(ObjectDTO obj)
  • 28. 28 Spring Integration Example 24 June 2014 Receiving messages via HTTP REST
  • 29. 29 Another option: JMS backed message channels Channel adapter are intended for applications that are integrating with other external systems. There are cases where both the producer and consumer for a given JMS Destination are intended to be part of the same application, running within the same process. <int-jms:channel id="jmsChannel" queue="exampleQueue"/> <int-jms:publish-subscribe-channel id="jmsChannel" topic="exampleTopic"/>  Support of transactions (“transaction-manager” atrribute)  Support for connection (session, consumer) cache  Concurrency (number of concurrent sessions/consumers to start for each listener) Spring Integration Example 24 June 2014
  • 30. 30 Task 2  An exteranl system feeds us with stream of JSON objects putting them to JMS queue  We need to make some calculations (business logic) using these objects in the order as they come  Depending on calculationd results we could change the persistent state of our domain objects  Incoming objects should be saved to our DB  Finally, the results of calculation should be sent in JSON format to another JMS queue Spring Integration Example 24 June 2014
  • 31. 31 Basic Flow Spring Integration Example 24 June 2014 Receive objects Validation convertion to entity Calculation Analyze and save results Send to outbound JMS Save entities to DB
  • 32. 32 Router Spring Integration Example 24 June 2014 • Payload Type Router • Header Value Router • Recipient List Router • XPath Router (Part of the XML Module) • Error Message Exception Type Router • (Generic) Router
  • 33. 33 Problem Spring Integration Example 24 June 2014 The incoming messages could arrive very frequently
  • 34. 34 Aggregator Spring Integration Example 24 June 2014 • Message Store • Correlation Strategy (delaults to grouping be MessageHeader.CORRELATION_ID) • Release Strategy • Expiration policy
  • 35. 35 Back to task 2: receive and aggregate Spring Integration Example 24 June 2014
  • 36. 36 Back to task 2: receive and aggregate Spring Integration Example 24 June 2014 boolean canReleaseMessages(List<IncObject>) List<IncObject> aggregate(List<IncObject>) Object getCorrelationKey(IncObject)
  • 37. 37 Back to task 2: routing Spring Integration Example 24 June 2014
  • 38. 38 Back to task 2: via publish-subscribe channel Spring Integration Example 24 June 2014
  • 39. 39 Task summary  Built on the top of other Spring modules (e. g. Spring JMS)  Every element of the chain – just a simple POJO  High cohesion  Easy to cover with unit-tests  “Convention over configuration” – bean with name “connectionFactory” will be found automatically  Change the whole business flow only by configuration Spring Integration Example 24 June 2014
  • 41. 41  Both projects aim to fill similar need: light-weight integration library with full implementations of EIP  Apache Camel introduces DSL (Java, Scala, Groovy). Spring Integration - only XML  Apache Camel supports longer list of technologies  Apache Camel offers rich support for both integration and unit-testing. Spring Integration supports just generic Spring Test  Apache Camel Community is larger, documentation is better Spring Integration Spring Integration VS Apache Camel 24 June 2014
  • 42. 42 Apache Camel Java DSL Example final JaxbDataFormat jaxbDataFormat = new JaxbDataFormat(); jaxbDataFormat.setContextPath(“test.ns.oxm"); jaxbDataFormat.setPartClass(“test.ns.oxm.ABSPartnerChangesEventType"); from("activemq:incoming.partner") .log("log:test.log") .choice() .when(header("EVENTTYPE").isEqualTo(“TESTVALUE")).to("direct:createPartner“) .when(header("EVENTTYPE").isEqualTo(“TESTVALUE2")).to("direct:updatePartner"); from("direct:createPartner") .errorHandler(noErrorHandler()) .unmarshal(jaxbDataFormat) .beanRef(“partnerChangeHandler", "createPartner"); from("direct:updatePartner") .errorHandler(noErrorHandler()) .unmarshal(jaxbDataFormat) .beanRef(“partnerChangeHandler", "updatePartner"); Spring Integration Spring Integration VS Apache Camel 24 June 2014
  • 43. 43 Recent changes  Spring EL support (3.0.2)  HTTP request mapping (based on Spring MVC infrastructure) (3.0.2)  Enhanced support for MongoDB, Redis and JPA (3.0.2)  @EnableIntegration, @IntegrationComponentScan (4.0.2)  Requires Spring 4.0 (4.0.2) Spring Integration Example 24 June 2014