Your SlideShare is downloading. ×
Real life use of Spring Integration with RabbitMQ
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Real life use of Spring Integration with RabbitMQ

1,987
views

Published on

Speaker: Durai Arasan …

Speaker: Durai Arasan
ETRADE has revamped their SOA platform with RabbitMQ as a core messaging system and Spring Integration as a light weight ESB layer with services written in Java, C and Python based languages. This new container show cases how legacy system can be migrated at the same time introducing more modern frameworks and languages without comprising on performance and scalability factor of new platform.
Presentation will cover some history behind the requirements and how the platform was built.
It will be followed by live demo with an example of running web services with RabbitMQ and Spring Integration. This platform highlights why RabbitMQ works best for such a need compare to other options.

Published in: Technology, Education

0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,987
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
48
Comments
0
Likes
5
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Real life use of Spring Integration with RabbitMQ By Durai Arasan, Director of Architecture, ETRADE Financial © 2013 SpringOne 2GX. All rights reserved. Do not distribute without permission. Monday, September 9, 13
  • 2. About Me Enterprise Java Technology Leader 2 Monday, September 9, 13
  • 3. Agenda §Background §Things that matter §Our ways to solve §Demo §Q&A Monday, September 9, 13
  • 4. Once upon a time ... 4 Monday, September 9, 13
  • 5. In the beginning ... • Early adopters of services • Large set of services –Anything and everything is a service –Many granular services • Payload formats –Mixed set of formats –Proprietary 5 Monday, September 9, 13
  • 6. Things that matter Top requirements for our need 6 Monday, September 9, 13
  • 7. Things that matter §Performance –Slow performance makes users leave –Instant response is expected LOADING ... Monday, September 9, 13
  • 8. Things that matter §Burst Load –Flood gates open –Zero to Sixty in no time Source: mashable.com Monday, September 9, 13
  • 9. Things that matter §Service Chains –Granular services end up in service chains –Parallel processing of services –Need to meet SLA –Keeping it in same context Monday, September 9, 13
  • 10. Things that matter §Simple Services –Keep services strictly to do business logic –POJOs driven –Container to do the heavy lifting • Routing, Filtering, Transforming, Splitting and aggregating handlers and many more Request Client Service Response Monday, September 9, 13
  • 11. Things that matter §Separation of concerns –Request Isolation • Bottleneck with all requests in one queue • Priority queues –Process Isolation • Impacting other services Monday, September 9, 13
  • 12. Things that matter §Services in new Languages –New languages are adopted widely –Gone are the days of few languages –Choose a language specific to a task • C, Java, Python, Ruby, Node.js and Perl Monday, September 9, 13
  • 13. Summary: Things that matter Meets the demand for new & old Lean & Fast Services Platform Web, Mobile Integration, Batch 13 Monday, September 9, 13
  • 14. How did we solve? 14 Monday, September 9, 13
  • 15. Enterprise Integration Pattern • Messaging is core to solve integration • Blueprint for solving –Payload Transformation –Protocol Converters –Filters –Aggregation (scatter gather) –Claim check pattern –and others ... 15 Monday, September 9, 13
  • 16. Goal: Lean Services Platform • Build with Messaging • Assemble components that work best • Meet all things matter • Build to support –Legacy Services –New Services 16 Monday, September 9, 13
  • 17. RabbitMQ • Popular AMQP implementation • High Performance • Robust Messaging • Large number of connections • Runs on many operating systems • Clients for many languages • Open Source Support • AMQP Extensions (DLX, AE etc) 17 Monday, September 9, 13
  • 18. Spring Integration • Based on EIP: Lightweight ESB & Service Host • Out of the box support for RabbitMQ • POJOs driven services • Gateways –Configuration driven –Extendable for other impls • Handlers for all use cases • Built-in JMX support 18 Monday, September 9, 13
  • 19. Architecture 19 Monday, September 9, 13
  • 20. Integrating Web Services 20 Monday, September 9, 13
  • 21. Spring Integration + Web Services • Used as an IDL rather than full-fledged container • Web Services Endpoints –jax-ws –jax-rs • No need to re-invent • Support for multiple transport • Messages are routed from broker to SI 21 Monday, September 9, 13
  • 22. Example JAX-WS Service Interface @WebService(name="Payment") public interface PaymentService {    @WebResult(partName="AccountRequest") @WebMethod(operationName="getAccount") public AccountRequest getAccount( @WebParam(partName="AccountId") int id) throws AccountRequestException; } 22 Monday, September 9, 13
  • 23. Example JAX-RS Service Interface @WebService(name="REST/Payment") public interface PaymentService { @GET @Path("/account/{id}") @WebMethod(operationName="account") public AccountRequest getAccount (@PathParam("id") int id); @POST @Path("/pay/{accountId}") @Consumes({"application/json", "text/xml"}) @WebMethod(operationName="payWithId") public PaymentResultResponse payWithAccountId (@PathParam("accountId") int accountId, ItemRequest paramItemRequest); } 23 Monday, September 9, 13
  • 24. Why DSL? • Custom name space support in SI • Simple things simple –Avoid repetitive patterns –Enables standard patterns • Complex things possible –Add additional on demand 24 Monday, September 9, 13
  • 25. Example w/o DSL <!-- INBOUND GATEWAY --> <int-amqp:inbound-gateway request-channel="echoInputChannel" queue-names="svc_echoQueue" concurrent-consumers="10" connection-factory="rabbitConnection"/> <!-- UNMARSHALLER --> <!-- the handler that processes the request from the inbound gateway --> <int:chain id="unmarshaller" input-channel="echoInputChannel" output-channel="echoServicesChannel" > <int-xml:unmarshalling-transformer unmarshaller="jaxb" /> <int:service-activator expression="payload.getValue()"></int:service-activator> </int:chain> <!-- ROUTER --> <!-- a router based on payload that dispatches the requests on it's input channel to the appropriate service activator --> <int:payload-type-router input-channel="echoServicesChannel"> <!-- based on the unmarshalled object type route to different channels --> <int:mapping type="com.etrade.schemas.etsvc.EchoSleepT" channel="echoSleepChannel" /> <int:mapping type="com.etrade.schemas.etsvc.EchoIncrementT" channel="echoIncrementChannel" /> <int:mapping type="com.etrade.schemas.etsvc.EchoPayloadT" channel="echoPayloadChannel" /> </int:payload-type-router> <!-- REQ/REPLY SERVICES --> <!-- messaging endpoints that are request and reply producing, and put all their outputs to the output channel that is then received by the marshaller--> <int:service-activator id="echoSleepService" input-channel="echoSleepChannel" ref="echoImpl" method="sleep" output-channel="echoOutChannel" /> <int:service-activator id="echoIncrementService" input-channel="echoIncrementChannel" ref="echoImpl" method="increment" output-channel="echoOutChannel"/> <int:service-activator id="echoPayloadService" input-channel="echoPayloadChannel" ref="echoImpl" method="echoPayload" output-channel="echoOutChannel"/> <!-- MARSHALLER --> <!-- the handler that processes the response from the services, the anonymous replyChannel of the outbound gateway creates the bridge --> <int:chain input-channel="echoOutChannel"> <int-xml:marshalling-transformer marshaller="jaxb" id="marshaller" result-type="StringResult"/> <int:object-to-string-transformer /> </int:chain> <!-- BEAN DECLARATION --> <bean id="echoImpl" class="com.etrade.service.echo.impl.EchoServiceImpl"/> <!-- ADMINISTRATION, RABBIT CONFIGS --> <rabbit:admin connection-factory="rabbitConnection"/> <rabbit:connection-factory id="rabbitConnection" /> <rabbit:template id="amqpTemplate" connection-factory="rabbitConnection" /> <!-- sets up the exchange --> <rabbit:queue name="svc_echoQueue" auto-delete="false" durable="true" exclusive="false"></rabbit:queue> <rabbit:direct-exchange name="etsvc_exchange"> <rabbit:bindings> <rabbit:binding queue="svc_echoQueue" key="svc_echoSleep"/> <rabbit:binding queue="svc_echoQueue" key="svc_echoPayLoad"/> <rabbit:binding queue="svc_echoQueue" key="svc_echoIncrement"/> </rabbit:bindings> </rabbit:direct-exchange> 25 Monday, September 9, 13
  • 26. Example w/ DSL <!-- transformers, routers, channels, service-activators are now assimilated!! :) --> <beans> <!-- gateway declaration --> <etrade:inbound-gateway service-interface="com.etrade.service.echo.Echo" ref="echoService" concurrent-consumers="5"/> <!-- bean declaration --> <bean id="echoService" class="com.etrade.service.echo.impl.EchoServiceImpl" /> </beans> 26 Monday, September 9, 13
  • 27. Use of standard WSDL Tools • Wsdl2java to produce java interfaces • Java2wsdl to produce wsdl • Bindings for wsdl (jaxb, et al) • Transport in wsdl (http, amqp) • Use of standard wsdl extensions 27 Monday, September 9, 13
  • 28. Payloads over AMQP • Standard service development –Using well known annotations (jax-ws & jax-rs) –Deployed under AMQP container • JAX-RS –All media types (text/xml, application/octet-stream etc) • JAX-WS –SOAP –XML/POX 28 Monday, September 9, 13
  • 29. SI + Web Services Flow 29 Monday, September 9, 13
  • 30. Demo Generic Sample Service 30 Monday, September 9, 13
  • 31. Next Steps Spring IO: 31 Monday, September 9, 13
  • 32. Summary • This model works for us • Performance meets our needs • Async Services help manage load • Decoupling of clients & endpoints • Platform that can run legacy and new services • Heterogeneous deployments in to single container 32 Monday, September 9, 13
  • 33. Learn More. Stay Connected. We are Hiring! career.etrade.com Twitter: twitter.com/duraiarasan LinkedIn: linkedin.com/in/duraiarasan Facebook: facebook.com/duraiarasan Monday, September 9, 13
  • 34. Q&A Monday, September 9, 13