RabbitMQ in Mule
RabbitMQ is well known and popular message broker and it has many powerful features. It is
open source message broker software and is written in the Erlang programming language and is
built on the Open Telecom Platform framework for clustering and failover
Features :-
• Robust messaging for applications
• Easy to use
• Runs on all major operating systems
• Supports a huge number of developer platforms
• Open source and commercially supported
Source :- RabbitMQ website
RabbitMQ works on a concept called Exchanges
Exchanges :- An exchange accepts messages from a producer application and routes them to
message queues. They can be thought of as the "mailboxes" of the AMQP world. Unlike some
other messaging middleware products and protocols, in AMQP, messages are not published
directly to queues. Messages are published to exchanges that route them to queue(s) using pre-
arranged criteria called bindings.
Source :- http://rubybunny.info/articles/exchanges.html
Exchange attributes :-
Exchanges have several attributes associated with them:
• Name
• Type (direct, fanout, topic, headers or some custom type)
• Durability
• Whether the exchange is auto-deleted when no longer used
• Other metadata (sometimes known as X-arguments)
Source :- http://rubybunny.info/articles/exchanges.html
Exchange types
There are four built-in exchange types in AMQP :
• Direct :- The exchange does a direct match between the routing key provided in the message
and the routing criteria used when a queue is bound to this exchange.
• Fanout:- Queues are bound to this exchange with no arguments. Hence any message sent to
this exchange will be forwarded to all queues bound to this exchange.
• Topic:- The exchange does a wildcard match between the routing key and the routing pattern
specified in the binding. The routing key is treated as zero or more words, delimited by ‘.’ and
supports special wildcard characters. “*” matches a single word and ‘#’ matches zero or more
words.
• Headers:- Queues are bound to this exchange with a table of arguments containing headers
and values (optional). A special argument named “x-match” determines the matching
algorithm, where “all” implies an AND (all pairs must match) and “any” implies OR (at least
one pair must match).
Source :- http://rajith.2rlabs.com/2007/10/13/amqp-in-10-mins-part4-standard-exchange-types-and-
supporting-common-messaging-use-cases/
So, how can we connect RabbitMQ with Mule ????
Mule connects with RabbitMq with AMQP connector available in Mule
Let’s consider there are 2 flows to send and receive message to and from RabbitMQ queue
using direct exchange
Our Mule Config will be :-
As you can see there are 2 flows , the first will send the message to the queue called new using Direct
Exchange and the receiver flow will receive the message from queue using the same Direct Exchange
To test the application, if we hit the url http://localhost:1080/orders4 , like the following :-
You will get the following into in the log:-
You can see the first flow send the message into the queue new, and the second flow receive the
message from the queue new. Both the flows have used the Direct Exchange technique
In my next slide I will bring some other techniques in Mule implementation .
Hope you have enjoyed this simpler version.
Keep sharing your knowledge and let our Mule community grow 
Rabbit Mq in Mule

Rabbit Mq in Mule

  • 1.
  • 2.
    RabbitMQ is wellknown and popular message broker and it has many powerful features. It is open source message broker software and is written in the Erlang programming language and is built on the Open Telecom Platform framework for clustering and failover
  • 3.
    Features :- • Robustmessaging for applications • Easy to use • Runs on all major operating systems • Supports a huge number of developer platforms • Open source and commercially supported Source :- RabbitMQ website
  • 4.
    RabbitMQ works ona concept called Exchanges Exchanges :- An exchange accepts messages from a producer application and routes them to message queues. They can be thought of as the "mailboxes" of the AMQP world. Unlike some other messaging middleware products and protocols, in AMQP, messages are not published directly to queues. Messages are published to exchanges that route them to queue(s) using pre- arranged criteria called bindings. Source :- http://rubybunny.info/articles/exchanges.html
  • 5.
    Exchange attributes :- Exchangeshave several attributes associated with them: • Name • Type (direct, fanout, topic, headers or some custom type) • Durability • Whether the exchange is auto-deleted when no longer used • Other metadata (sometimes known as X-arguments) Source :- http://rubybunny.info/articles/exchanges.html
  • 6.
    Exchange types There arefour built-in exchange types in AMQP : • Direct :- The exchange does a direct match between the routing key provided in the message and the routing criteria used when a queue is bound to this exchange. • Fanout:- Queues are bound to this exchange with no arguments. Hence any message sent to this exchange will be forwarded to all queues bound to this exchange. • Topic:- The exchange does a wildcard match between the routing key and the routing pattern specified in the binding. The routing key is treated as zero or more words, delimited by ‘.’ and supports special wildcard characters. “*” matches a single word and ‘#’ matches zero or more words. • Headers:- Queues are bound to this exchange with a table of arguments containing headers and values (optional). A special argument named “x-match” determines the matching algorithm, where “all” implies an AND (all pairs must match) and “any” implies OR (at least one pair must match). Source :- http://rajith.2rlabs.com/2007/10/13/amqp-in-10-mins-part4-standard-exchange-types-and- supporting-common-messaging-use-cases/
  • 7.
    So, how canwe connect RabbitMQ with Mule ????
  • 8.
    Mule connects withRabbitMq with AMQP connector available in Mule
  • 9.
    Let’s consider thereare 2 flows to send and receive message to and from RabbitMQ queue using direct exchange
  • 10.
    Our Mule Configwill be :- As you can see there are 2 flows , the first will send the message to the queue called new using Direct Exchange and the receiver flow will receive the message from queue using the same Direct Exchange
  • 11.
    To test theapplication, if we hit the url http://localhost:1080/orders4 , like the following :-
  • 12.
    You will getthe following into in the log:- You can see the first flow send the message into the queue new, and the second flow receive the message from the queue new. Both the flows have used the Direct Exchange technique
  • 13.
    In my nextslide I will bring some other techniques in Mule implementation . Hope you have enjoyed this simpler version. Keep sharing your knowledge and let our Mule community grow 