• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
(Oleg zhurakousky)spring integration-scala-intro
 

(Oleg zhurakousky)spring integration-scala-intro

on

  • 1,883 views

 

Statistics

Views

Total Views
1,883
Views on SlideShare
1,634
Embed Views
249

Actions

Likes
0
Downloads
26
Comments
0

2 Embeds 249

http://skillsmatter.com 241
http://smash 8

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    (Oleg zhurakousky)spring integration-scala-intro (Oleg zhurakousky)spring integration-scala-intro Presentation Transcript

    • 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
    • Enterprise IntegrationPatterns (EIP)Copyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 2
    • Messaging • Integration starts with MessagingCopyright 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-drivenCopyright 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 ; doneCopyright 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 PayloadCopyright 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/SubscribeCopyright 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 ConsumersCopyright 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 multipleCopyright 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 objectsCopyright 2005-2010 SpringSource. Copying, publishing or distributing without express written permission is prohibit 10
    • The Big PictureCopyright 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 ConfigurationCopyright 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 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
    • ToolingCopyright 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 - "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
    • 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 featuresCopyright 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 cant 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