Enterprise Integration Patterns                         using             Scala and Spring Integration                    ...
Enterprise IntegrationPatterns (EIP)Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express ...
Messaging   • Integration starts with MessagingCopyright 2005-2010 SpringSource. Copying, publishing or distributing witho...
Why Messaging?   • Logical Decoupling   • Physical Decoupling             – Producer and Consumer are not aware of one    ...
Pipes and Filters             – Endpoints (Filters) connected through             – Channels (Pipes) exchanging           ...
Message   • Payload can be any object   • Header values are stored in a Map                                               ...
Message Channel• Decouples Producers from Consumers• Provides extension point for interceptors• May be Point-to-Point• Or ...
Message Endpoint   • Producers send Messages to a Message     Channel   • Depending on their type, Message Channels     ma...
Message Endpoint Types   • Transformer             – Convert payload or modify headers   • Filter             – Discard me...
What is Spring Integration?  • Framework is a reference implementation    of Enterprise Integration Patterns  • Built on t...
The Big PictureCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is...
Spring Programming Model  • Inversion of Control             – Endpoints delegate to Spring-managed objects             – ...
Message Channel Types        <channel id="sync-p2p"/>        <channel id="async-p2p">           <dispatcher task-executor=...
Messaging Endpoints       <int:gateway service-interface="foo.bar.MyGateway"                     default-request-channel="...
Channel Adapters andMessaging Gateways   •       JMS                                                                      ...
ToolingCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibi...
Where does Scala fit in?Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written perm...
Why Scala?  • There are 2 types of people in this world     – Like to say - "Dont like XML"     – "Dont like XML" - but un...
Is XML or not to XML enough of an                          argument?Copyright 2005-2010 SpringSource. Copying, publishing ...
Why Scala? (cont. . .)  • True Type Safety vs IDE-Specific support  • Typos and misconfiguration  • Adding value based on ...
Welcome to SI Scala DSL        val messageFlow =                 filter.using{p:String => p.equals("Cool World")} -->     ...
Welcome to SI Scala DSL  • Compile time validation vs initialization    validation and type safety:              filter.us...
Relevant Info  • Enterprise Integration Patterns - http://www.eaipatterns.com/  • Spring Integration project home -    htt...
Upcoming SlideShare
Loading in …5
×

(Oleg zhurakousky)spring integration-scala-intro

1,973 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,973
On SlideShare
0
From Embeds
0
Number of Embeds
253
Actions
Shares
0
Downloads
29
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

(Oleg zhurakousky)spring integration-scala-intro

  1. 1. Enterprise Integration Patterns using Scala and Spring Integration Oleg Zhurakousky SpringSource/VMware Twitter: z_oleg Email: ozhurakousky@vmware.comCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit
  2. 2. Enterprise IntegrationPatterns (EIP)Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 2
  3. 3. Messaging • Integration starts with MessagingCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 3
  4. 4. Why Messaging? • Logical Decoupling • Physical Decoupling – Producer and Consumer are not aware of one another • Easy to extend • Event-drivenCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 4
  5. 5. Pipes and Filters – Endpoints (Filters) connected through – Channels (Pipes) exchanging – Message $> cat foo.txt | grep the | while read l; do echo $l ; doneCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 5
  6. 6. Message • Payload can be any object • Header values are stored in a Map Headers PayloadCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 6
  7. 7. Message Channel• Decouples Producers from Consumers• Provides extension point for interceptors• May be Point-to-Point• Or Publish/SubscribeCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 7
  8. 8. Message Endpoint • Producers send Messages to a Message Channel • Depending on their type, Message Channels may have Polling Consumers • Or Event-Driven ConsumersCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 8
  9. 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 multipleCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 9
  10. 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 objectsCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 10
  11. 11. The Big PictureCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 11
  12. 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 ConfigurationCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 12
  13. 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. 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. 15. Channel Adapters andMessaging 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. 16. ToolingCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 16
  17. 17. Where does Scala fit in?Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit
  18. 18. Why Scala? • There are 2 types of people in this world – Like to say - "Dont like XML" – "Dont 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. 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. 20. Why Scala? (cont. . .) • True Type Safety vs IDE-Specific support • Typos and misconfiguration • Adding value based on the language featuresCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 20
  21. 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. 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 cant continue) Etc. . .Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 22
  23. 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

×