RabbitMQ may be a message-queuing software also referred to as a message broker or queue manager. Simply said: it’s a software where queues are defined, to which applications connect so as to transfer a message or messages.
A message can include any quite information. It could, for instance , have information a few process or task that ought to start on another application (which could even get on another server), or it might be just an easy text message. The queue-manager software saves the messages until a receiving application connects and takes a message from the queue. The receiving application then processes the message.
Why Do We Need RabbitMQ?
RabbitMQ is an AMQP broker, i.e. a service that runs exterior to your application, probably on a separate cluster of servers. AMQP is simply the protocol that’s wont to communicate with a message queuing broker like RabbitMQ. You get tons of things from RabbitMQ. you’ll send messages persistently with guaranteed delivery in order that they will arrive albeit your app crashes, and albeit the RabbitMQ broker finishes up being restarted. You get load balancing between message consumers if you’ve got multiple consumers on an equivalent queue. You get interoperability with apps in other languages as long as you employ a fairly open serialization format for your message bodies. AMQP allows you to interrupt up a monolithic app into many loosely coupled parts which will run on different servers. this is often an enormous win for future maintenance of an application.
RabbitMQ also supports multiple protocols, such as:
Sample for RabbitMQ!
- The user sends a PDF creation request to the online application.
- The web application (the producer) sends a message to RabbitMQ that has data from the request like name and email.
- An exchange accepts the messages from the producer and routes them to correct message queues for PDF creation.
- The PDF processing worker (the consumer) receives the task message and starts processing the PDF.
Types of Exchanges
- Direct: The message is routed to the queues whose binding key exactly matches the routing key of the message. for instance , if the queue is sure to the exchange with the binding key pdf process, a message published to the exchange with a routing key pdfprocess is routed thereto queue.
- Fanout: A fanout exchange routes messages to all or any of the queues sure to it.
- Topic: the subject exchange does a wildcard match between the routing key and therefore the routing pattern laid out in the binding.
- Headers: Headers exchange use messages header attributes for routing.
Important Features of RabbitMQ
RabbitMQ offers a spread of features to allow you to trade off performance with reliability, including persistence, delivery acknowledgements, publisher confirms, and high availability.
Messages are routed through exchanges prior reaching at queues. RabbitMQ features several built-in exchange types for typical routing logics. For more complex routing you’ll bind exchanges together or maybe write your own exchange type as a plugin.
Several RabbitMQ servers on an area network are often clustered together, forming one logical broker.
For servers that require to be more loosely and unreliably connected than clustering allows, RabbitMQ offers a federation model.
Highly Available Queues
Queues are often mirrored across several machines during a cluster, ensuring that even within the event of hardware failure your messages are safe.
RabbitMQ supports messaging over a spread of messaging protocols.
There are RabbitMQ clients for nearly any language you’ll consider .
RabbitMQ ships with an easy-to use management UI that permits you to watch and control every aspect of your message broker.
If your messaging system is misbehaving, RabbitMQ offers tracing support to allow you to determine what’s happening .