SlideShare a Scribd company logo
Enterprise Integration Patterns
                         using
             Scala and Spring Integration

                                                          Oleg Zhurakousky
                                                        SpringSource/VMware

                                          Twitter: z_oleg
                                Email: ozhurakousky@vmware.com



Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit
Enterprise Integration
Patterns (EIP)




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   2
Messaging

   • Integration starts with Messaging




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   3
Why Messaging?

   • Logical Decoupling
   • Physical Decoupling
             – Producer and Consumer are not aware of one
               another
   • Easy to extend
   • Event-driven




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   4
Pipes and Filters

             – Endpoints (Filters) connected through
             – Channels (Pipes) exchanging
             – Message




   $> cat foo.txt | grep the | while read l; do echo $l ; done




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   5
Message

   • Payload can be any object
   • Header values are stored in a Map


                                                                                                                       Headers



                                                                                                                       Payload




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit             6
Message Channel

• Decouples Producers from Consumers
• Provides extension point for interceptors
• May be Point-to-Point




• Or Publish/Subscribe




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   7
Message Endpoint

   • Producers send Messages to a Message
     Channel
   • Depending on their type, Message Channels
     may have Polling Consumers




   • Or Event-Driven Consumers




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   8
Message Endpoint Types

   • Transformer
             – Convert payload or modify headers
   • Filter
             – Discard messages based on boolean evaluation
   • Router
             – Determine next channel based on content
   • Splitter
             – Generate multiple messages from one
   • Aggregator
             – Assemble a single message from multiple


Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   9
What is Spring Integration?

  • Framework is a reference implementation
    of Enterprise Integration Patterns

  • Built on top of Spring
             – Runs within any Spring ApplicationContext
             – All components are Spring-managed objects




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   10
The Big Picture




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   11
Spring Programming Model

  • Inversion of Control
             – Endpoints delegate to Spring-managed objects
             – Framework handles message reception and
               method invocation


  • Clean separation of Code and Configuration




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   12
Message Channel Types
        <channel id="sync-p2p"/>

        <channel id="async-p2p">
           <dispatcher task-executor="someThreadPool" />
        </channel>

        <channel id="async-buffering-p2p">
           <queue capacity="50" />
        </channel>

        <publish-subscribe-channel id="sync-pubsub" />

        <publish-subscribe-channel id="async-pubsub"
                                   task-executor="someThreadPool" />




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   13
Messaging Endpoints

       <int:gateway service-interface="foo.bar.MyGateway"
                     default-request-channel="inChannel" />

       <int:filter input-channel="inChannel"
                   expression="payload.equals('World')"
                    output-channel="transformingChannel" />

       <channel id="transformingChannel">
          <dispatcher task-executor="executor" />
       </channel>

       <int:transformer input-channel="transformingChannel"
                        expression="'Hello ' + payload"
                        output-channel="loggingChannel" />

       <int:service-activator input-channel="loggingChannel"
                expression="T(java.lang.System).out.println(payload)"/>



Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   14
Channel Adapters and
Messaging Gateways
   •       JMS                                                                        •       HTTP (REST)
   •       AMQP                                                                       •       RIA (Flex, AJAX)
   •       TCP/UDP                                                                    •       WS (SOAP/POX)
   •       File/Resource                                                              •       Mail (POP3/IMAP/SMTP)
   •       RMI                                                                        •       JDBC
   •       RSS/ATOM                                                                   •       XMPP
   •       FTP/FTPS/SFTP                                                              •       Twitter
   •       NoSQL(Mongo,                                                               •       Spring Events
           Redis)                                                                     •       BPMN 2.0 (Activiti)

Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   15
Tooling




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   16
Where does Scala fit in?




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit
Why Scala?

  • There are 2 types of people in this world
     – Like to say - "Don't like XML"
     – "Don't like XML" - but understand that its
       necessary evil. Appreciate alternatives but
       not overly concerned with the lack of.




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   18
Is XML or not to XML enough of an
                          argument?




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit
Why Scala? (cont. . .)

  • True Type Safety vs IDE-Specific support
  • Typos and misconfiguration
  • Adding value based on the language features




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   20
Welcome to SI Scala DSL


        val messageFlow =
                 filter.using{p:String => p.equals("Cool World")} -->
                 transform.using{p:String => "Goodbye " + p} -->
                 handle.using{p:String => println(p)}


        messageFlow.sendAndReceive[String]("Cool World")




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   21
Welcome to SI Scala DSL

  • Compile time validation vs initialization
    validation and type safety:
              filter.using{p:String => "Cool World"} - (filter can *only* return Boolean)
                  type mismatch; found : String => java.lang.String required: Function1[_, Boolean]


              transform.using{p:String => println} - (transformer *must* return non-Unit value)


              handle.using{p:String => println(p)} -->
              handle.using{p:String => println(p)}
              - value --> is not a member of o.s.i.d.SendingIntegrationComposition
              (the first handler returns Unit (nothing of value in Messaging terms therefore the flow
               can't continue)


  Etc. . .
Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   22
Relevant Info

  • Enterprise Integration Patterns - http://www.eaipatterns.com/
  • Spring Integration project home -
    http://www.springsource.org/spring-integration
  • Spring Integration Scala DSL home -
    https://github.com/SpringSource/spring-integration-scala/wiki
  • Spring Integration Scala DSL blog -
    http://blog.springsource.org/2012/03/05/introducing-spring-integration-




Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit   23

More Related Content

PDF
What's next for Java API for WebSocket (JSR 356)
PDF
WebSockets in Enterprise Applications
PDF
Lo nuevo en Spring 3.0
PDF
JavaOne 2014 BOF4241 What's Next for JSF?
PDF
Apache Camel Introduction
PDF
04.egovFrame Runtime Environment Workshop
PDF
RESTful Services and Distributed OSGi - 04/2009
PDF
03.eGovFrame Runtime Environment Training Book Supplement
What's next for Java API for WebSocket (JSR 356)
WebSockets in Enterprise Applications
Lo nuevo en Spring 3.0
JavaOne 2014 BOF4241 What's Next for JSF?
Apache Camel Introduction
04.egovFrame Runtime Environment Workshop
RESTful Services and Distributed OSGi - 04/2009
03.eGovFrame Runtime Environment Training Book Supplement

What's hot (20)

PDF
Introducing Scalate, the Scala Template Engine
PDF
Developer’s intro to the alfresco platform
PPTX
Websphere Application Server: Much more than Open Source
PDF
CRX Best practices
PDF
02.egovFrame Development Environment workshop I
PDF
01.egovFrame Training Book II
PDF
WebSocket in Enterprise Applications 2015
PDF
How to Thrive on REST/WebSocket-Based Microservices
PPTX
Spring integration
PDF
ApacheCon NA 2010 - Building Apps with Apache Tuscany
PDF
Batch Applications for Java Platform 1.0: Java EE 7 and GlassFish
PPT
Apache Harmony: An Open Innovation
PDF
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
PDF
ApacheCon NA 2010 - High Performance Cloud-enabled SCA Runtimes
PDF
Single API for library services (poster)
PDF
02.egovFrame Development Environment training book
PPT
An Introduction to Websphere sMash for PHP Programmers
PDF
A Java Implementer's Guide to Better Apache Spark Performance
PDF
Fusesource camel-persistence-part1-webinar-charles-moulliard
Introducing Scalate, the Scala Template Engine
Developer’s intro to the alfresco platform
Websphere Application Server: Much more than Open Source
CRX Best practices
02.egovFrame Development Environment workshop I
01.egovFrame Training Book II
WebSocket in Enterprise Applications 2015
How to Thrive on REST/WebSocket-Based Microservices
Spring integration
ApacheCon NA 2010 - Building Apps with Apache Tuscany
Batch Applications for Java Platform 1.0: Java EE 7 and GlassFish
Apache Harmony: An Open Innovation
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
ApacheCon NA 2010 - High Performance Cloud-enabled SCA Runtimes
Single API for library services (poster)
02.egovFrame Development Environment training book
An Introduction to Websphere sMash for PHP Programmers
A Java Implementer's Guide to Better Apache Spark Performance
Fusesource camel-persistence-part1-webinar-charles-moulliard
Ad

Viewers also liked (18)

PDF
CukeUp! 2012: Michael Nacos on Just enough infrastructure for product develop...
PPTX
Mindmap john
PDF
Marek pubsubhuddle realtime_web
PDF
Couch db skillsmatter-prognosql
PPT
PPTX
PPTX
K O N P E T E N T Z I A D I G I T A L A
PPT
Pdhpe pp
PPT
SCALA DAYS 2012: Ben Parker on Interactivity - Anti-XML in Anger
PDF
Tmt predictions 2011
PPT
Presentation
PDF
Jordan west real workscalazfinal2
PPT
Mesures deutors hipotecaris rdl 27 12
PPT
Mesures deutors hipotecaris rdl 27 12
PDF
Martin sustrik future_of_messaging
PDF
Audit toolkit
PDF
Real World Scalaz
CukeUp! 2012: Michael Nacos on Just enough infrastructure for product develop...
Mindmap john
Marek pubsubhuddle realtime_web
Couch db skillsmatter-prognosql
K O N P E T E N T Z I A D I G I T A L A
Pdhpe pp
SCALA DAYS 2012: Ben Parker on Interactivity - Anti-XML in Anger
Tmt predictions 2011
Presentation
Jordan west real workscalazfinal2
Mesures deutors hipotecaris rdl 27 12
Mesures deutors hipotecaris rdl 27 12
Martin sustrik future_of_messaging
Audit toolkit
Real World Scalaz
Ad

Similar to (Oleg zhurakousky)spring integration-scala-intro (20)

PPTX
Spring Integration Splunk
PDF
Leverage Enterprise Integration Patterns with Apache Camel and Twitter
PDF
Make easier Integration of your services with Fuse Solutions - RedHat 2013
PDF
Experiences of SOACS
PDF
Operations and Monitoring with Spring
PDF
01 overview-and-setup
PPTX
Apache camel overview dec 2011
PDF
02 basics
PDF
Stratos Open PaaS OSCON 2011
PPTX
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
PDF
Provisioning with Oracle Cloud Stack Manager
PPTX
REST Enabling your Oracle Database (2018 Update)
PDF
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg
PDF
JAX-RS.next
PDF
Stackato
PDF
Kick Start your Application Development and Management Strategy
KEY
Gaelyk - Paris GGUG 2011 - Guillaume Laforge
PDF
OSGi for real in the enterprise: Apache Karaf - NLJUG J-FALL 2010
PDF
DBCC 2021 - FLiP Stack for Cloud Data Lakes
PPTX
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Spring Integration Splunk
Leverage Enterprise Integration Patterns with Apache Camel and Twitter
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Experiences of SOACS
Operations and Monitoring with Spring
01 overview-and-setup
Apache camel overview dec 2011
02 basics
Stratos Open PaaS OSCON 2011
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
Provisioning with Oracle Cloud Stack Manager
REST Enabling your Oracle Database (2018 Update)
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg
JAX-RS.next
Stackato
Kick Start your Application Development and Management Strategy
Gaelyk - Paris GGUG 2011 - Guillaume Laforge
OSGi for real in the enterprise: Apache Karaf - NLJUG J-FALL 2010
DBCC 2021 - FLiP Stack for Cloud Data Lakes
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck

More from Skills Matter Talks (7)

PPTX
Zaharia spark-scala-days-2012
PDF
Cnc scala-presentation
PDF
Arvindsujeeth scaladays12
PDF
Scala days mizushima
PDF
Project kepler compile time metaprogramming for scala
PDF
Test driven infrastructure
PDF
Prediction suretogowrong
Zaharia spark-scala-days-2012
Cnc scala-presentation
Arvindsujeeth scaladays12
Scala days mizushima
Project kepler compile time metaprogramming for scala
Test driven infrastructure
Prediction suretogowrong

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PDF
Modernizing your data center with Dell and AMD
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Empathic Computing: Creating Shared Understanding
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Cloud computing and distributed systems.
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Approach and Philosophy of On baking technology
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
KodekX | Application Modernization Development
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
MYSQL Presentation for SQL database connectivity
Modernizing your data center with Dell and AMD
Chapter 3 Spatial Domain Image Processing.pdf
Unlocking AI with Model Context Protocol (MCP)
20250228 LYD VKU AI Blended-Learning.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Empathic Computing: Creating Shared Understanding
“AI and Expert System Decision Support & Business Intelligence Systems”
Mobile App Security Testing_ A Comprehensive Guide.pdf
Cloud computing and distributed systems.
Machine learning based COVID-19 study performance prediction
Digital-Transformation-Roadmap-for-Companies.pptx
A Presentation on Artificial Intelligence
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Approach and Philosophy of On baking technology
The AUB Centre for AI in Media Proposal.docx
KodekX | Application Modernization Development
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

(Oleg zhurakousky)spring integration-scala-intro

  • 1. Enterprise Integration Patterns using Scala and Spring Integration Oleg Zhurakousky SpringSource/VMware Twitter: z_oleg Email: ozhurakousky@vmware.com Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit
  • 2. Enterprise Integration Patterns (EIP) Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 2
  • 3. Messaging • Integration starts with Messaging Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 3
  • 4. Why Messaging? • Logical Decoupling • Physical Decoupling – Producer and Consumer are not aware of one another • Easy to extend • Event-driven Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 4
  • 5. Pipes and Filters – Endpoints (Filters) connected through – Channels (Pipes) exchanging – Message $> cat foo.txt | grep the | while read l; do echo $l ; done Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 5
  • 6. Message • Payload can be any object • Header values are stored in a Map Headers Payload Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 6
  • 7. Message Channel • Decouples Producers from Consumers • Provides extension point for interceptors • May be Point-to-Point • Or Publish/Subscribe Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 7
  • 8. Message Endpoint • Producers send Messages to a Message Channel • Depending on their type, Message Channels may have Polling Consumers • Or Event-Driven Consumers Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 8
  • 9. Message Endpoint Types • Transformer – Convert payload or modify headers • Filter – Discard messages based on boolean evaluation • Router – Determine next channel based on content • Splitter – Generate multiple messages from one • Aggregator – Assemble a single message from multiple Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 9
  • 10. What is Spring Integration? • Framework is a reference implementation of Enterprise Integration Patterns • Built on top of Spring – Runs within any Spring ApplicationContext – All components are Spring-managed objects Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 10
  • 11. The Big Picture Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 11
  • 12. Spring Programming Model • Inversion of Control – Endpoints delegate to Spring-managed objects – Framework handles message reception and method invocation • Clean separation of Code and Configuration Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 12
  • 13. Message Channel Types <channel id="sync-p2p"/> <channel id="async-p2p"> <dispatcher task-executor="someThreadPool" /> </channel> <channel id="async-buffering-p2p"> <queue capacity="50" /> </channel> <publish-subscribe-channel id="sync-pubsub" /> <publish-subscribe-channel id="async-pubsub" task-executor="someThreadPool" /> Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 13
  • 14. Messaging Endpoints <int:gateway service-interface="foo.bar.MyGateway" default-request-channel="inChannel" /> <int:filter input-channel="inChannel" expression="payload.equals('World')" output-channel="transformingChannel" /> <channel id="transformingChannel"> <dispatcher task-executor="executor" /> </channel> <int:transformer input-channel="transformingChannel" expression="'Hello ' + payload" output-channel="loggingChannel" /> <int:service-activator input-channel="loggingChannel" expression="T(java.lang.System).out.println(payload)"/> Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 14
  • 15. Channel Adapters and Messaging Gateways • JMS • HTTP (REST) • AMQP • RIA (Flex, AJAX) • TCP/UDP • WS (SOAP/POX) • File/Resource • Mail (POP3/IMAP/SMTP) • RMI • JDBC • RSS/ATOM • XMPP • FTP/FTPS/SFTP • Twitter • NoSQL(Mongo, • Spring Events Redis) • BPMN 2.0 (Activiti) Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 15
  • 16. Tooling Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 16
  • 17. Where does Scala fit in? Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit
  • 18. Why Scala? • There are 2 types of people in this world – Like to say - "Don't like XML" – "Don't like XML" - but understand that its necessary evil. Appreciate alternatives but not overly concerned with the lack of. Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 18
  • 19. Is XML or not to XML enough of an argument? Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit
  • 20. Why Scala? (cont. . .) • True Type Safety vs IDE-Specific support • Typos and misconfiguration • Adding value based on the language features Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 20
  • 21. Welcome to SI Scala DSL val messageFlow = filter.using{p:String => p.equals("Cool World")} --> transform.using{p:String => "Goodbye " + p} --> handle.using{p:String => println(p)} messageFlow.sendAndReceive[String]("Cool World") Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 21
  • 22. Welcome to SI Scala DSL • Compile time validation vs initialization validation and type safety: filter.using{p:String => "Cool World"} - (filter can *only* return Boolean) type mismatch; found : String => java.lang.String required: Function1[_, Boolean] transform.using{p:String => println} - (transformer *must* return non-Unit value) handle.using{p:String => println(p)} --> handle.using{p:String => println(p)} - value --> is not a member of o.s.i.d.SendingIntegrationComposition (the first handler returns Unit (nothing of value in Messaging terms therefore the flow can't continue) Etc. . . Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 22
  • 23. Relevant Info • Enterprise Integration Patterns - http://www.eaipatterns.com/ • Spring Integration project home - http://www.springsource.org/spring-integration • Spring Integration Scala DSL home - https://github.com/SpringSource/spring-integration-scala/wiki • Spring Integration Scala DSL blog - http://blog.springsource.org/2012/03/05/introducing-spring-integration- Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 23