Apidays New York 2024 - The value of a flexible API Management solution for O...
Mule rabbit mq
1.
2. 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
3. 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
4. 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
5. 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
6. 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/
8. Let’s consider there are 2 flows to send and receive message to and from
RabbitMQ queue using direct exchange
9. 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
10. To test the application, if we hit the url http://localhost:1080/orders4 , like the
following :-
11. 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
12. 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