Upload
opencredo
View
2.473
Download
2
Embed Size (px)
DESCRIPTION
Message-oriented software is on the increase after building a formidable home in the heart of many large-scale transaction processing systems in the finance industry. MoM is seeing a resurgence with the general recognition that everything from the newest languages (Erlang, Scala et al) through to Web Services and ESBs uses message passing to introduce a looser coupling and better separation of concerns in integration solutions.In this talk Russ Miles, Principle Consultant and CEO of Open Credo, will introduce a light-weight approach to introducing message passing patterns into your software architecture using Spring Integration.
Citation preview
www.opencredo.com
Spring Integration 1.0.X and What’s coming in 2.0
Russ Miles, CEO, OpenCredoOriginally prepared by Jonas Partner,
OpenCredo Principal Consultant,
Committer on Spring Integration
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
• Author– AspectJ Cookbook– Learning UML 2.0– Head First Software
Development
• “Thought Leader”– Cloud Computing Editor– QCon– Large-scale Agile
Conference
Who is Russ Miles anyway?
• OpenCredo– CEO– Consultancy– Training– SpringSource
Certified Deliver Partner
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Agenda
• Enterprise Integration Patterns• Why Spring Integration• What Spring Integration provides• Some live coding...• Whats new in SI 2.0
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Enterprise Integration Patterns
• Book by Gregor Hohpe and Bobby Wolf• Documents
– Styles of Integration database, file, messages and channels
– Patterns• Splitter• Router• Transformer
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Messages
Generic package for data (the Message payload) that can be transported via channels
Headers provide information to other components that consume from channelsSequence Number
Sequence Size
...
Headers
Payload
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Channels
Channels deliver messages from producers to consumers
Producer Channel Consumer
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Why use messaging 1/2
• Loose coupling– Localise impact of changes– Improve separation of concerns
• Easy Interception– Mediation– Filtering– Reroute
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Why use messaging 2/2
• Performance– Less blocking since async– Efficient use of resources
• Threads• DB Connections
– Useful with multi core processors
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Agenda
• Enterprise Integration Patterns• Why Spring Integration• What Spring Integration provides• Some live coding...• Whats new in SI 2.0
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Why Spring Integration
• Spring goodness in the integration space– Light-weight, not a server– Non invasive POJO programming model– Testable– Builds on strong foundation, Spring
• Reusable Enterprise Integration Pattern implementations
• Message and Channel approach useful for non integration applications
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Light-Weight
• Spring Integration != Spring ESB• Simply components in applications context
– Wiring together through dependency injection– Channels beans, adapters beans ...– Follows application context lifecycle
• Simple adoption
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Agenda
• Why Spring Integration• Enterprise Integration Patterns• Spring Integration provides
– Enterprise Integration Patterns implementation
– Message and Channel framework– Adapters
• Some live coding...• Whats new in SI 2.0
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Transformer
@Transformer public Document convert(Document doc){ return convertToNewFormat(doc); }
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Splitter
@Splitter public List<Document> orderItems(Document doc){
return splitOrder(doc); }
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Router
@Router public String resolveDrinkChannel(Drink drink) {
return (drink.isIced()) ? "coldDrinks" : "hotDrinks"; }
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Chain
<chain input-channel="input" output-channel="output"> <filter ref="someSelector" throw-exception-on-rejection="true"/> <header-enricher error-channel="customErrorChannel"> <header name="foo" value="bar"/> </header-enricher> <service-activator ref="someService" method="someMethod"/> </chain>
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Agenda
• Why Spring Integration• Enterprise Integration Patterns• Spring Integration provides
– Enterprise Integration Patterns implementation
– Message and Channel framework– Adapters
• Some live coding...• Whats new in SI 2.0
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
SI Messages
public interface Message<T> { MessageHeaders getHeaders; T getPayload(); }
Simple Interface
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Provided Message Implementations
• GenericMessage– Uses generics for strongly typed payload
• StringMessage– String payload
• Most components don’t care
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Channel
• DirectChannel• QueueChannel• Pub Sub• Rendezvous• Executor
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Agenda
• Why Spring Integration• Enterprise Integration Patterns• Spring Integration provides
– Enterprise Integration Patterns implementation
– Message and Channel framework– Adapters
• Some live coding...• Whats new in SI 2.0
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Adapter
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Current Adapters
• JMS• RMI• Http Invoker• HTTP• File• Spring Web Services• Mail Spring Application Events
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Agenda
• Why Spring Integration• Enterprise Integration Patterns• Spring Integration provides• Some live coding...• Whats new in SI 2.0
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
NoodleBar Demo
Loose Coupling, Messages, Channels
and “Something Completely Different”
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Agenda
• Why Spring Integration• Enterprise Integration Patterns• Spring Integration provides• Some live coding...• Whats new in SI 2.0
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Spring Integration 2.0 1/2
• Due early this year– JDBC– Twitter??– Suggestions/requests/contributions
• Improved testing framework• Spring 3.0 expression language
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Spring Integration 2.0 2/2
• XQuery• JMS Backed channel (not an adapter)• Other patterns
– Claim Check– Scatter Gather– Process Manager....
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Also Spring Extensions
• Home to FTP adapters and other contributions – http://www.springsource.org/extensions/
se-sia• Spring Integration .Net
– http://www.springsource.org/extensions/se-springintegration-net
– Nearly a port of java.util.concurrent http://www.springsource.org/extensions/se-threading-net
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Where to go next...
• Grab the code:– http://www.springsource.org/spring-integration
• Grab hold of Tareq :)
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
And, of course, a book plug!
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Summary
• Spring Integration provides...– ...a lightweight way to ...– ... introduce looser, message-oriented
coupling between components...– ...that enables integration problems to be
solved using integration patterns...– ...right inside your existing application!
No bloated middleware required!
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Thanks for your time!
Any questions?
Email: [email protected]
Web: http://www.opencredo.com
Blog: http://www.russmiles.com
Twitter: russmiles
Monday, 25 January 2010