SlideShare a Scribd company logo
1 of 37
High Powered Messaging with James Carr Software Engineer OCI
About Your Speaker
A Brief Introduction to Messaging How can I integrate multiple applications to work together and share data? Use Messaging to transfer packets of data frequently, immediately, reliably, and asynchronously, using customizable formats.
You might need messaging if… Need to integrate different systems to work together Need to scale Need to be able to monitor data feeds Decoupled Publishers and Subscribers Queuing and Buffering for later delivery
You Might Not Need Messaging If… Just need single process asynchronous behavior Want to just isolate concepts within the application (package scope or even OSGi might work better here) Use your best judgement! 
The Bible On Messaging Ignore all the SOA books, if you really want to dig deep and understand messaging, I suggest
Brief Overview of Messaging Before we dig deep, it’s good to have a brief overview of concepts that are used in messaging
Message Broker How do we decouple the destination from the sender? Manages the routing of messages to intended destinations
Message Channel A message channel is what connects two peers Sender writes to channel, receiver reads from channel
Point-to-Point Channel A channel that connects one sender with only one reciever
Publish-Subscribe Channel Delivers a copy of the message to each receiver subscribing to the channel
Dead Letter Channel Where a messaging system sends a message that is undeliverable
Dynamic Router Route a message to different receiver based on some property of the message
The Sad State of Messaging ,[object Object]
Lots and lots of vendor locked in solutions exist (yes, I’m looking at YOU, Oracle)
Complex, proprietary, and closed
Support contracts and licensing fees can shoot into the stratosphere,[object Object]
Open Standards to the Rescue! AMQP STOMP XMPP JSON-RPC For this presentation I’ll mostly cover AMQP, but delve a little into STOMP
       AMQP Features
Where? Who?
AMQPAdvanced Message Queuing Prototcol Defines the wire level protocol (whereas JMS defines only an API) Completely open and specified by the AMQP Working Group Includes many companies, such as J.P. Morgan, Bank of America, Cisco, Red Hat, iMatrix, Rabbit Technologies, etc. Defines the semantics of server and client behavior to ensure interoperability.
A Quick Overview
Components of AMQP Broker – Manages exchanges, queues, etc. Channel – Logical representation of the connection, maintains state Exchanges – entities to which a message is sent Queues – receive messages sent to an exchange Binding – Relationship between an exchange and a queue Messages – The actual message sent and received. Two important parts: a routing key and the body
Message Headers Routing Key – used to route messages, dependent on the type of exchange (more on this soon) Priority – a value 0 to 9 that indicates if this message has priority in queues over others Delivery-mode – can be used to indicate if the message will need persistence.  Expiration – duration in milliseconds that the broker should use to dertermine of the  message is unroutable.
Exchange Types Direct: if a queue is bound with routing key “A” only messages with that routing key will be sent to the queue.  Topic: broker will match the routing key against a pattern to dermine which queue to send to. For example, “uk.#” will receive any messages with a key starting with “uk.” Fanout: 1 to N delivery pattern in which routing keys are ignored. All queues bound to the exchange will receive the message.
Exchanges Who creates exchanges? Clients do.  Other configurable properties:  Passive: will not create the exchange, but will fail if it doesn’t exist. Durable: exchange will survive a broker restart Auto-delete: exchange will get deleted as soon as there are no more queues bound to it.
Queues Queues receive messages, in order Consumers subscribe to queues Consumers can also consume the queue as they see fit  Inherits the same properties an exchange has (durable, auto-delete,passive) with a couple additional ones: Exclusive: only one client can subscribe to this queue Alternate-exchange: exchange to reroute rejected or orphaned messages
Binding Specifies how messages flow from exchange to queue Match the routing algorithm used in the exchange Direct: “foo.bar.baz” Fanout: “#” Topic: “foo.*.baz” or “foo.#”
Check out http://www.amqp.org if you want to learn more.
AMQP Brokers ActiveMQ - http://activemq.apache.org/ ZeroMQ(integrates with) – http://zeromq.org Apache Qpid - http://qpid.apache.org/ RabbitMQ - http://www.rabbitmq.com/
Why RabbitMQ? Built on top of Open Telecom Platform erlang libraries Used by leading telecom companies for high performance distributed network applications Clustering support Implements the latest AMQP spec (0.9) Various plugins for additional features (json-rpc, STOMP, HTTP, etc) Popular framework integration: Spring, grails, rails, node.js, etc.
Side Note… Personally I like ActiveMQ because it’s easy to embed within an existing java application  It also supports STOMP over websockets I often do this for integration tests against components that interact with JMS You can also do this and hit rabbitmq in the real app as well (Open Standards FTW) Okay, that’s kind of a moot point, in java I can do this if I use Weblogic JMS, SeriesMQ, etc.
Commandline Control Start up: rabbitmqctlstart_app Status: rabbitmqctl status List queues: rabbitmqctllist_queues
Enough Jibber Jabber! Show me an example fool!
Use Case Site written in node.js needs to make use of existing, well established JEE backend services We want the whole operation to be asynchronous Node.js sends message on exchange A JEE application picks up message off queue, does work, sends message out on exchange B Node.js picks message up off queue and does required work.
Using RabbitMQ in Java The client library from the rabbitmq site Apache camel’s amqp component to send and receive messages from rabbitmq spring-amqp (currently available as a milestone release, 1.0.0.M1) This means you mavenizers will need to use the alternate repository location http://maven.springframework.org/milestone There’s also a rabbitmq grails plugin. 

More Related Content

What's hot

RabbitMQ fairly-indepth
RabbitMQ fairly-indepthRabbitMQ fairly-indepth
RabbitMQ fairly-indepthWee Keat Chin
 
RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009Paolo Negri
 
Scaling applications with RabbitMQ at SunshinePHP
Scaling applications with RabbitMQ   at SunshinePHPScaling applications with RabbitMQ   at SunshinePHP
Scaling applications with RabbitMQ at SunshinePHPAlvaro Videla
 
RabbitMQ Data Ingestion
RabbitMQ Data IngestionRabbitMQ Data Ingestion
RabbitMQ Data IngestionAlvaro Videla
 
The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP Eberhard Wolff
 
Introduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQIntroduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQDmitriy Samovskiy
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPEberhard Wolff
 
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)James Titcumb
 
RabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsRabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsHoucheng Lin
 
Integrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQIntegrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQGavin Roy
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQKnoldus Inc.
 
Messaging with amqp and rabbitmq
Messaging with amqp and rabbitmqMessaging with amqp and rabbitmq
Messaging with amqp and rabbitmqSelasie Hanson
 
Distributed messaging with AMQP
Distributed messaging with AMQPDistributed messaging with AMQP
Distributed messaging with AMQPWee Keat Chin
 
Messaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQMessaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQPOSSCON
 
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...Paolo Negri
 
[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging QueuesNaukri.com
 

What's hot (20)

RabbitMQ fairly-indepth
RabbitMQ fairly-indepthRabbitMQ fairly-indepth
RabbitMQ fairly-indepth
 
RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009
 
Scaling applications with RabbitMQ at SunshinePHP
Scaling applications with RabbitMQ   at SunshinePHPScaling applications with RabbitMQ   at SunshinePHP
Scaling applications with RabbitMQ at SunshinePHP
 
RabbitMQ Data Ingestion
RabbitMQ Data IngestionRabbitMQ Data Ingestion
RabbitMQ Data Ingestion
 
AMQP with RabbitMQ
AMQP with RabbitMQAMQP with RabbitMQ
AMQP with RabbitMQ
 
The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP
 
Introduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQIntroduction to AMQP Messaging with RabbitMQ
Introduction to AMQP Messaging with RabbitMQ
 
RabbitMQ Operations
RabbitMQ OperationsRabbitMQ Operations
RabbitMQ Operations
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQP
 
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
 
RabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example ApplicationsRabbitMQ Model and Some Example Applications
RabbitMQ Model and Some Example Applications
 
Integrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQIntegrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQ
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQ
 
Messaging with amqp and rabbitmq
Messaging with amqp and rabbitmqMessaging with amqp and rabbitmq
Messaging with amqp and rabbitmq
 
Message Broker System and RabbitMQ
Message Broker System and RabbitMQMessage Broker System and RabbitMQ
Message Broker System and RabbitMQ
 
Distributed messaging with AMQP
Distributed messaging with AMQPDistributed messaging with AMQP
Distributed messaging with AMQP
 
Spring RabbitMQ
Spring RabbitMQSpring RabbitMQ
Spring RabbitMQ
 
Messaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQMessaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQ
 
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
 
[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues
 

Viewers also liked

Integrating RabbitMQ with PHP
Integrating RabbitMQ with PHPIntegrating RabbitMQ with PHP
Integrating RabbitMQ with PHPAlvaro Videla
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askCarlos Abalde
 
Scaling RabbitMQ to 11
Scaling RabbitMQ to 11Scaling RabbitMQ to 11
Scaling RabbitMQ to 11Gavin Roy
 
AMQP: interopérabilité et découplage de systèmes hétérogènes avec RabbitMQ
AMQP: interopérabilité et découplage de systèmes hétérogènes avec RabbitMQAMQP: interopérabilité et découplage de systèmes hétérogènes avec RabbitMQ
AMQP: interopérabilité et découplage de systèmes hétérogènes avec RabbitMQMicrosoft
 
Roman Kuznietsov: Zeromq: sockets on steroids.Zero mq
Roman Kuznietsov: Zeromq: sockets on steroids.Zero mqRoman Kuznietsov: Zeromq: sockets on steroids.Zero mq
Roman Kuznietsov: Zeromq: sockets on steroids.Zero mqSphere Consulting Inc
 
Introduction to ActiveMQ Apollo
Introduction to ActiveMQ ApolloIntroduction to ActiveMQ Apollo
Introduction to ActiveMQ Apollodejanb
 
Taste Rabbitmq
Taste RabbitmqTaste Rabbitmq
Taste Rabbitmqjeff kit
 
新浪微博开放平台Redis实战
新浪微博开放平台Redis实战新浪微博开放平台Redis实战
新浪微博开放平台Redis实战mysqlops
 
高性能No sql数据库redis
高性能No sql数据库redis高性能No sql数据库redis
高性能No sql数据库redispaitoubing
 
Introduction to ZeroMQ - eSpace TechTalk
Introduction to ZeroMQ - eSpace TechTalkIntroduction to ZeroMQ - eSpace TechTalk
Introduction to ZeroMQ - eSpace TechTalkMahmoud Said
 

Viewers also liked (17)

Amqp Basic
Amqp BasicAmqp Basic
Amqp Basic
 
Integrating RabbitMQ with PHP
Integrating RabbitMQ with PHPIntegrating RabbitMQ with PHP
Integrating RabbitMQ with PHP
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
 
Introduction to Heroku Postgres
Introduction to Heroku PostgresIntroduction to Heroku Postgres
Introduction to Heroku Postgres
 
Scaling RabbitMQ to 11
Scaling RabbitMQ to 11Scaling RabbitMQ to 11
Scaling RabbitMQ to 11
 
AMQP: interopérabilité et découplage de systèmes hétérogènes avec RabbitMQ
AMQP: interopérabilité et découplage de systèmes hétérogènes avec RabbitMQAMQP: interopérabilité et découplage de systèmes hétérogènes avec RabbitMQ
AMQP: interopérabilité et découplage de systèmes hétérogènes avec RabbitMQ
 
Roman Kuznietsov: Zeromq: sockets on steroids.Zero mq
Roman Kuznietsov: Zeromq: sockets on steroids.Zero mqRoman Kuznietsov: Zeromq: sockets on steroids.Zero mq
Roman Kuznietsov: Zeromq: sockets on steroids.Zero mq
 
ZeroMQ
ZeroMQZeroMQ
ZeroMQ
 
Introduction to ActiveMQ Apollo
Introduction to ActiveMQ ApolloIntroduction to ActiveMQ Apollo
Introduction to ActiveMQ Apollo
 
Taste Rabbitmq
Taste RabbitmqTaste Rabbitmq
Taste Rabbitmq
 
新浪微博开放平台Redis实战
新浪微博开放平台Redis实战新浪微博开放平台Redis实战
新浪微博开放平台Redis实战
 
高性能No sql数据库redis
高性能No sql数据库redis高性能No sql数据库redis
高性能No sql数据库redis
 
Introduction to ZeroMQ - eSpace TechTalk
Introduction to ZeroMQ - eSpace TechTalkIntroduction to ZeroMQ - eSpace TechTalk
Introduction to ZeroMQ - eSpace TechTalk
 
Professional profile
Professional profileProfessional profile
Professional profile
 
Open channels
Open channelsOpen channels
Open channels
 
AMQP 1.0 introduction
AMQP 1.0 introductionAMQP 1.0 introduction
AMQP 1.0 introduction
 
Redis介绍
Redis介绍Redis介绍
Redis介绍
 

Similar to High powered messaging with RabbitMQ

The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKXMike Willbanks
 
RabbitMQ interview Questions and Answers
RabbitMQ interview Questions and AnswersRabbitMQ interview Questions and Answers
RabbitMQ interview Questions and Answersjeetendra mandal
 
Rabbitmq & Kafka Presentation
Rabbitmq & Kafka PresentationRabbitmq & Kafka Presentation
Rabbitmq & Kafka PresentationEmre Gündoğdu
 
ActiveMQ interview Questions and Answers
ActiveMQ interview Questions and AnswersActiveMQ interview Questions and Answers
ActiveMQ interview Questions and Answersjeetendra mandal
 
Apache Camel interview Questions and Answers
Apache Camel interview Questions and AnswersApache Camel interview Questions and Answers
Apache Camel interview Questions and Answersjeetendra mandal
 
Message Oriented Middleware
Message Oriented MiddlewareMessage Oriented Middleware
Message Oriented MiddlewareManuswath K.B
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Jason Townsend, MBA
 
Air traffic controller - Streams Processing meetup
Air traffic controller  - Streams Processing meetupAir traffic controller  - Streams Processing meetup
Air traffic controller - Streams Processing meetupEd Yakabosky
 
Patterns&Antipatternsof SOA
Patterns&Antipatternsof SOAPatterns&Antipatternsof SOA
Patterns&Antipatternsof SOAMohamed Samy
 
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure FunctionsMessaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure FunctionsJohn Staveley
 
quickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationquickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationjorgesimao71
 
Beyond REST and RPC: Asynchronous Eventing and Messaging Patterns
Beyond REST and RPC: Asynchronous Eventing and Messaging PatternsBeyond REST and RPC: Asynchronous Eventing and Messaging Patterns
Beyond REST and RPC: Asynchronous Eventing and Messaging PatternsClemens Vasters
 
Integration Patterns With Spring integration
Integration Patterns With Spring integrationIntegration Patterns With Spring integration
Integration Patterns With Spring integrationEldad Dor
 
WSO2 Product Release Webinar Introducing the WSO2 Message Broker
WSO2 Product Release Webinar   Introducing the WSO2 Message BrokerWSO2 Product Release Webinar   Introducing the WSO2 Message Broker
WSO2 Product Release Webinar Introducing the WSO2 Message BrokerWSO2
 

Similar to High powered messaging with RabbitMQ (20)

The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKX
 
RabbitMQ interview Questions and Answers
RabbitMQ interview Questions and AnswersRabbitMQ interview Questions and Answers
RabbitMQ interview Questions and Answers
 
Rabbitmq & Kafka Presentation
Rabbitmq & Kafka PresentationRabbitmq & Kafka Presentation
Rabbitmq & Kafka Presentation
 
Messaging in Java
Messaging in JavaMessaging in Java
Messaging in Java
 
ActiveMQ interview Questions and Answers
ActiveMQ interview Questions and AnswersActiveMQ interview Questions and Answers
ActiveMQ interview Questions and Answers
 
Wcf faq
Wcf faqWcf faq
Wcf faq
 
Apache Camel interview Questions and Answers
Apache Camel interview Questions and AnswersApache Camel interview Questions and Answers
Apache Camel interview Questions and Answers
 
Message Oriented Middleware
Message Oriented MiddlewareMessage Oriented Middleware
Message Oriented Middleware
 
RabbitMq
RabbitMqRabbitMq
RabbitMq
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003
 
Air traffic controller - Streams Processing meetup
Air traffic controller  - Streams Processing meetupAir traffic controller  - Streams Processing meetup
Air traffic controller - Streams Processing meetup
 
Axis2
Axis2Axis2
Axis2
 
Patterns&Antipatternsof SOA
Patterns&Antipatternsof SOAPatterns&Antipatternsof SOA
Patterns&Antipatternsof SOA
 
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure FunctionsMessaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
 
quickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationquickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integration
 
Art Of Message Queues
Art Of Message QueuesArt Of Message Queues
Art Of Message Queues
 
Beyond REST and RPC: Asynchronous Eventing and Messaging Patterns
Beyond REST and RPC: Asynchronous Eventing and Messaging PatternsBeyond REST and RPC: Asynchronous Eventing and Messaging Patterns
Beyond REST and RPC: Asynchronous Eventing and Messaging Patterns
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Integration Patterns With Spring integration
Integration Patterns With Spring integrationIntegration Patterns With Spring integration
Integration Patterns With Spring integration
 
WSO2 Product Release Webinar Introducing the WSO2 Message Broker
WSO2 Product Release Webinar   Introducing the WSO2 Message BrokerWSO2 Product Release Webinar   Introducing the WSO2 Message Broker
WSO2 Product Release Webinar Introducing the WSO2 Message Broker
 

High powered messaging with RabbitMQ

  • 1. High Powered Messaging with James Carr Software Engineer OCI
  • 3. A Brief Introduction to Messaging How can I integrate multiple applications to work together and share data? Use Messaging to transfer packets of data frequently, immediately, reliably, and asynchronously, using customizable formats.
  • 4. You might need messaging if… Need to integrate different systems to work together Need to scale Need to be able to monitor data feeds Decoupled Publishers and Subscribers Queuing and Buffering for later delivery
  • 5. You Might Not Need Messaging If… Just need single process asynchronous behavior Want to just isolate concepts within the application (package scope or even OSGi might work better here) Use your best judgement! 
  • 6. The Bible On Messaging Ignore all the SOA books, if you really want to dig deep and understand messaging, I suggest
  • 7. Brief Overview of Messaging Before we dig deep, it’s good to have a brief overview of concepts that are used in messaging
  • 8. Message Broker How do we decouple the destination from the sender? Manages the routing of messages to intended destinations
  • 9. Message Channel A message channel is what connects two peers Sender writes to channel, receiver reads from channel
  • 10. Point-to-Point Channel A channel that connects one sender with only one reciever
  • 11. Publish-Subscribe Channel Delivers a copy of the message to each receiver subscribing to the channel
  • 12. Dead Letter Channel Where a messaging system sends a message that is undeliverable
  • 13. Dynamic Router Route a message to different receiver based on some property of the message
  • 14.
  • 15. Lots and lots of vendor locked in solutions exist (yes, I’m looking at YOU, Oracle)
  • 17.
  • 18. Open Standards to the Rescue! AMQP STOMP XMPP JSON-RPC For this presentation I’ll mostly cover AMQP, but delve a little into STOMP
  • 19. AMQP Features
  • 21. AMQPAdvanced Message Queuing Prototcol Defines the wire level protocol (whereas JMS defines only an API) Completely open and specified by the AMQP Working Group Includes many companies, such as J.P. Morgan, Bank of America, Cisco, Red Hat, iMatrix, Rabbit Technologies, etc. Defines the semantics of server and client behavior to ensure interoperability.
  • 23. Components of AMQP Broker – Manages exchanges, queues, etc. Channel – Logical representation of the connection, maintains state Exchanges – entities to which a message is sent Queues – receive messages sent to an exchange Binding – Relationship between an exchange and a queue Messages – The actual message sent and received. Two important parts: a routing key and the body
  • 24. Message Headers Routing Key – used to route messages, dependent on the type of exchange (more on this soon) Priority – a value 0 to 9 that indicates if this message has priority in queues over others Delivery-mode – can be used to indicate if the message will need persistence. Expiration – duration in milliseconds that the broker should use to dertermine of the message is unroutable.
  • 25. Exchange Types Direct: if a queue is bound with routing key “A” only messages with that routing key will be sent to the queue. Topic: broker will match the routing key against a pattern to dermine which queue to send to. For example, “uk.#” will receive any messages with a key starting with “uk.” Fanout: 1 to N delivery pattern in which routing keys are ignored. All queues bound to the exchange will receive the message.
  • 26. Exchanges Who creates exchanges? Clients do. Other configurable properties: Passive: will not create the exchange, but will fail if it doesn’t exist. Durable: exchange will survive a broker restart Auto-delete: exchange will get deleted as soon as there are no more queues bound to it.
  • 27. Queues Queues receive messages, in order Consumers subscribe to queues Consumers can also consume the queue as they see fit Inherits the same properties an exchange has (durable, auto-delete,passive) with a couple additional ones: Exclusive: only one client can subscribe to this queue Alternate-exchange: exchange to reroute rejected or orphaned messages
  • 28. Binding Specifies how messages flow from exchange to queue Match the routing algorithm used in the exchange Direct: “foo.bar.baz” Fanout: “#” Topic: “foo.*.baz” or “foo.#”
  • 29. Check out http://www.amqp.org if you want to learn more.
  • 30. AMQP Brokers ActiveMQ - http://activemq.apache.org/ ZeroMQ(integrates with) – http://zeromq.org Apache Qpid - http://qpid.apache.org/ RabbitMQ - http://www.rabbitmq.com/
  • 31. Why RabbitMQ? Built on top of Open Telecom Platform erlang libraries Used by leading telecom companies for high performance distributed network applications Clustering support Implements the latest AMQP spec (0.9) Various plugins for additional features (json-rpc, STOMP, HTTP, etc) Popular framework integration: Spring, grails, rails, node.js, etc.
  • 32.
  • 33. Side Note… Personally I like ActiveMQ because it’s easy to embed within an existing java application It also supports STOMP over websockets I often do this for integration tests against components that interact with JMS You can also do this and hit rabbitmq in the real app as well (Open Standards FTW) Okay, that’s kind of a moot point, in java I can do this if I use Weblogic JMS, SeriesMQ, etc.
  • 34. Commandline Control Start up: rabbitmqctlstart_app Status: rabbitmqctl status List queues: rabbitmqctllist_queues
  • 35. Enough Jibber Jabber! Show me an example fool!
  • 36. Use Case Site written in node.js needs to make use of existing, well established JEE backend services We want the whole operation to be asynchronous Node.js sends message on exchange A JEE application picks up message off queue, does work, sends message out on exchange B Node.js picks message up off queue and does required work.
  • 37. Using RabbitMQ in Java The client library from the rabbitmq site Apache camel’s amqp component to send and receive messages from rabbitmq spring-amqp (currently available as a milestone release, 1.0.0.M1) This means you mavenizers will need to use the alternate repository location http://maven.springframework.org/milestone There’s also a rabbitmq grails plugin. 
  • 38. Dirty Details… Licensed under the Mozilla Public License Commercial Support Exists Get it now, be up and running in minutes. Contribute!
  • 39. Links My Node.js example: http://github.com/jamescarr/nodejs-amqp-example Spring AMQP: http://www.springsource.org/spring-amqp Apache Camel: http://camel.apache.org/ RabbitMQhttp://www.rabbitmq.com Open Source Repository: http://www.rabbitmq.com RabbitMQplugin for grails: http://blog.springsource.com/2010/08/23/rabbitmq-plugin-for-grails-early-access/