Messaging for Modern Applications


Published on

Many businesses are faced with some new messaging challenges for modern applications, such as horizontal scalability of the messaging tier, heterogeneous messaging systems and access methods, and extreme transaction processing. This presentation/demo will cover how businesses can overcome these messaging challenges with the use of Spring and RabbitMQ technologies. Tom will build a case for AMQP, explain how SpringSource is providing AMQP support via Spring AMQP and Spring Integration, explain how RabbitMQ is a modern messaging solution that offers a reliable, highly available, scalable and portable messaging system with predictable and consistent throughput and latency, and demonstrate how Spring Integration and RabbitMQ can be progressively introduced into a standard Spring web application deployed on Cloud Foundry.

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Messaging for Modern Applications

  1. 1. Taking the next step shouldn’t be scary …1
  2. 2. Messaging for Modern ApplicationsTom McCuchStaff Systems Engineer, VMwareEmail: tmccuch@vmware.comTwitter: @spring_tomSource Code for these demos:é)© 2011 SpringOne 2GX. All rights reserved. Do not distribute without permission.
  3. 3. Session Agenda•  Modern Applications –  Trends and Impact on Messaging –  Impact on Application Architecture•  Spring Integration –  Messaging Use Cases –  Messaging DSL for Spring Applications•  AMQP –  Why AMQP? –  AMQP Architecture•  RabbitMQ –  Why RabbitMQ? –  RabbitMQ Architecture
  4. 4. Modern Application Trends•  Written with frameworks –  Developer productivity and innovation•  New Application Types –  Mobile, SaaS, Social –  Apps released early and often•  Data intensive –  Emerging requirements: elasticity, multi-cloud –  Web orientation drives exponential data volumes•  Deployed on virtual and cloud infrastructure –  Trending toward hybrid (public and private) infrastructure
  5. 5. Modern Applications need Modern Messaging Traditional approaches to messaging imply predictable, static interaction between well-known end-points Modern approaches to messagingembrace the unpredictable, dynamic, and transient nature of the web
  6. 6. Synchronous Architecture is Brittle An exception occurred, Manage please resend Inventory Place Fulfill Order Order X X X X X X X X X Schedule Delivery If any component is unavailable within this synchronous flow, all in-flight messages will be affected, regardless of what component they are currently in -- and since state is maintained across the components, the system can be complex to reset
  7. 7. Asynchronous Architecture Rules the Web The status of your order is I can fulfill … part of that Order I have an Order I can fulfill part of Your order will that Order be delivered next Tuesday I’ll schedule delivery of that order In this asynchronous flow: •  all state is kept in the simple messages being passed •  each stateless component interacts only with the broker cloud •  if a component is lost, only the in-flight messages within that component must be re-delivered •  components can be quickly provisioned on-demand
  8. 8. How is Messaging Used within Modern Apps?§  Event I need to know when to do something§  Fragment I need to only give you a piece of this data§  Route Control who gets which message, without changing sender or receiver§  Batch Producer and consumer can run at independent times§  Publish Tell everyone who wants to know about this§  Modularity Deploy, Scale, and Version a distributed system8
  9. 9. EventI need to know when to do something … <service-activator input-channel="hotDrinks” ref="barista" method="prepareHotDrink" output-channel="preparedDrinks” /> An Event-Driven Consumer is one that is automatically handed messages as they’re delivered on the channel. The receiver acts like the message delivery is an event that triggers the receiver into action.9
  10. 10. FragmentI need to only give you this piece of data … <int:splitter input-channel="orders” expression="payload.items” output-channel="drinks” /> Use a Splitter to break out the composite message into a series of individual messages, each containing data related to one item.10
  11. 11. RouteControl who gets what message <int:router input-channel="drinks” expression="payload.iced ? coldDrinks : hotDrinks” />A Router consumes a Message from one Channel and republishes it to a different Channel channel depending on a set of conditions.11
  12. 12. BatchProducer and Consumer can run at independent times <int:channel id="preparedDrinks"/> <int:aggregator input-channel="preparedDrinks" method="prepareDelivery" output-channel="deliveries” > <bean class=""/> </int:aggregator>Use a stateful filter, an Aggregator, to collect and store individual messages until a complete set of related messages has been received. Then, the Aggregator publishes a single message distilled from the individual messages.12
  13. 13. PublishTell everyone who wants to know about this <int-event:outbound-channel-adapter channel="eventChannel"/> All messages sent to the eventChannel channel will be published as ApplicationEvents to any relevant ApplicationListener instances that are registered within the same Spring ApplicationContext.13
  14. 14. ModularityDeploy, Scale, Version a distributed system Local Distributed <service-activator <int-amqp:outbound-gateway input-channel="coldDrinks” id="coldDrinksBarista" ref="barista” request-channel="coldDrinks” method="prepareColdDrink” reply-channel="preparedDrinks” output-channel="preparedDrinks” /> routing-key="ordered.drinks.cold” /> <service-activator <int-amqp:outbound-gateway input-channel="hotDrinks” id="hotDrinksBarista" ref="barista" request-channel="hotDrinks” method="prepareHotDrink" reply-channel="preparedDrinks” output-channel="preparedDrinks” /> routing-key="” /> Spring Integration doesn’t force you to finalize decisions about deployment before testing begins. Individual modules can be versioned, deployed, and scaled independently at any time through configuration, not code.14
  15. 15. Demo – Introducing the Spring Integration Café Demo15
  16. 16. Advanced Message Queuing Protocol “Like  email,  but  you  can  send   money  over  it”   Open,  Ubiquitous,  and   Adaptable   async SMTP AMQP sync HTTP IIOP unreliable reliable16
  17. 17. Why AMQP? A  Protocol,  not  an  API   •  A defined set of messaging capabilities called the AMQ model •  A network wire-level protocol, AMQP   On  commodity  hardware   •  10-­‐25  thousand  messages   per  second  is  rou>ne  *   •  The  NIC  is  usually  the   boDleneck     *  Non-­‐persistent  messages  17
  18. 18. Why AMQP?AMQP  security  •  Brokers  support  separate   virtual  hosts  •  Three  levels  of  permissions  •  AMQP  over  SSL  is  supported   Designed  to  scale  horizontally   •  Dozens  of  clustered  brokers   are  common   •  JPMorgan  sends  1  billion   AMQP  messages  per  day   18
  19. 19. AMQP Architecture new.order new.order new.order routing key binding M1 M2 M3 queue19
  20. 20. AMQP Architecture café deliveries M1 M2 M3 queue café NA deliveries M1 M2 M3 queue café WW deliveries M1 M2 M3 queue20
  21. 21. AMQP Architecture all_drinks 1 2 3 queue drink.cold cold_drinks 2 queue hot_drinks 1 Message Routing Keys: queue 1. 2.  drink.cold 3.  drink.warm21
  22. 22. Demo – Scaling the Café Demo with AMQP in Cloud Foundry22
  23. 23. Legacy Middleware not suited for Modern Apps Apps & Middleware Existing middleware impacts agility by tightly coupling applications to underlying application server and other middleware components Costly to Scale Up Complex to Scale Out Licensed by Peak Physical Servers23
  24. 24. RabbitMQ – Messaging that Just Works design goal: no bloat - “it just works” mission: “be everywhere” AMQP LEADER
  25. 25. Incredible Community Lowers Your Cost of Use !"##$%(0$.%-$#G%,0(#K(C4.%(@$/G9(%KE,(E8"i4-C. !"##$%&`j<>("/0(&$:-4.4R(2g7(E"-%/,-.+$E A,(4^,-(E":T"?,.(F4-(C"/K(4%+,-(=Q(E8"i4-C.;84G0("/0(WG$80H!G/H&"/"?,(*$88(0-$3,(C4-,(."8,.
  26. 26. Enterprise Users, such as this Tier-1 Telco
  27. 27. Enterprise Features, such as Clustering RMQ Cluster1 queue-1 RMQ1 1 queue-2 RMQ2 2 queue-3 RMQ3 3 1.  queue-1 2.  queue-3 3.  queue-227
  28. 28. Enterprise Features, such as Fault Tolerance ESX1 VM1 VM2 RMQ1 RMQ2 hot-drinks hot-drinks cold-drinks cold-drinksmasterslave
  29. 29. Our New Mission: “It’s Just There” Java App Private Cloud Hybrid Cloud vFabric Cloud Foundry vFabric Cloud Foundry Ruby App vSphere vSphere Downloadable Micro Cloud1.  Build your messaging application vFabric Cloud Foundry2.  Deploy it, Scale it using Messaging Service Service Provider3.  Move on or off premise as needed
  30. 30. RabbitMQ Hybrid Cloud Deployment Federated RabbitMQ Linux / Amazon EC2 new.order cafe-remote RabbitMQ Linux / VMware Fusion amqp new.order M1 M2 M3 queue cafe-direct
  31. 31. Demo – Deploying the Café Demo with RabbitMQ in a Hybrid Cloud31
  32. 32. Summary•  Modern Applications –  Use frameworks, less emphasis on servers –  The explosion of connected mobile devices requires a new solution for messaging•  Spring Integration –  A DSL for introducing messaging abstractions into your spring application –  Externalizes messaging concepts from code•  AMQP –  A TCP/IP protocol not an API –  Fast, Reliable, Open, Secure, Scalable•  RabbitMQ –  AMQP Leader –  Backed by VMware
  33. 33. Thank You!33