RabbitMQ is an open source message broker software written in Erlang. It uses exchanges to route messages from producers to queues based on routing keys or bindings. There are four main exchange types - direct, fanout, topic, and headers. The direct exchange routes messages to queues based on an exact match between the routing key and binding key.
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/
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