mule with rabbit mq

14
Mule With RabbitMQ

Upload: mdfkhan625

Post on 14-Jan-2017

149 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Mule with rabbit mq

Mule With RabbitMQ

Page 2: Mule with rabbit mq

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

Page 3: Mule with rabbit mq

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

Page 4: Mule with rabbit mq

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

Page 5: Mule with rabbit mq

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

Page 6: Mule with rabbit mq

Exchange typesThere 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/

Page 7: Mule with rabbit mq

So, how can we connect RabbitMQ with Mule ????

?

Page 8: Mule with rabbit mq

Mule connects with RabbitMq with AMQP connector available in Mule

Page 9: Mule with rabbit mq

Let’s consider there are 2 flows to send and receive message to and from RabbitMQ queue using direct exchange

Page 10: Mule with rabbit mq

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

Page 11: Mule with rabbit mq

To test the application, if we hit the url http://localhost:1080/orders4 , like the following :-

Page 12: Mule with rabbit mq

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

Page 13: Mule with rabbit mq

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

Page 14: Mule with rabbit mq

Thank You