RabbitMq

7
Advanced message queuing RabbitMQ

Transcript of RabbitMq

Page 1: RabbitMq

Advanced message queuing

RabbitMQ

Page 2: RabbitMq

What is Messaging system ?System that allow applications to send and receive messages

• Allows application modules to be distributed over heterogeneous platforms• Reduces the complexity of developing applications• Creates a distributed communications layer

Benefits of Messaging ?

Why using Messaging?• Get data from point A to point B• Decouple publishers and consumers• Queueing for later delivery• Asynchronous• Load balancing and scalability

Page 3: RabbitMq

RabbitMQ

What is RabbitMQ ?Message broker, accept messages and forward messagesLike Postman and PostOffice

Why RabbitMQ ?• Message durability and routing• Clustering and high availability support• Multi-protocol• Many Clients (PHP, Java,C, Erlang, ruby)• Tracing• Management UI• Access control

Page 4: RabbitMq

How it works ?

Protocol components?

RabbitMQ based on AMQP (Advanced Messaging Queuing Protocol)

AMQP use publisher, consumers, Exchange and QueuePublisher : User application that sends messagesExchange : Receive from Publisher and push to QueueQueue : Buffer that stores messagesConsumer : User application that receives messages

How it works ?Publisher connect to AMQ with a virtual host it intends to

operate Server check the access control for the Publisher on this virtual hostPublisher send it’s message to

ExchangeExchange delivers messages to QueuesQueue store messages for ConsumerConsumer pull messages from Queue

Page 5: RabbitMq

In-depth

Can be persistentCan be deleted when emptyCan be deleted when server stops

Queues

MessagesMessages carry content (header + body)Content body is opaque block of binary dataBroker never modifies content body

ExchangeRoute messages based on criteriaDoesn’t store messagescan inspect message content can be created at runtime

BindingsRelationship between an exchange and a queueCan take an extra routing_key parameterMeaning of a binding key depends on the exchange type

Page 6: RabbitMq

Exchange typesDirect

Direct exchange delivers messages to queues based on a message routing keydirect exchange is ideal for the unicast routing of messages

FanoutFanout routes messages to all of the queuesthat are bound to it and the routing key is ignoredideal for the broadcast routing of messages.

Page 7: RabbitMq

Questions ?