RabbitMQ is messaging technology used to provide asynchronous communication and decouple processes. Also it can be called message-queueing software or queue manager. Simply said; It is a software where queues can be defined, applications may connect to the queue and transfer a message onto it.
RabbitMQ Top Use Cases
- RabbitMQ enables your system to communicate with services written in different languages, on different platforms. By using JSON documents.
- Used for queueing tasks needed to be done by your web server. That allows the server to handle more work.
- Deals with seemingly impossible response time requirements for web-hooks.
- Scales heavily used services without actually scaling them.
- Can be used as message broker in event driven micro-services eco-system.
Basic RabbitMQ Structure
Exchanges are message routing agents, defined per virtual host within RabbitMQ. An exchange is responsible for the routing of the messages to the different queues. An exchange accepts messages from the producer application and routes them to message queues with help of header attributes, bindings, and routing keys. More details.
One exchange can handle many queues. Queue can have more than one consumer and consumer can consume from more than one queue. For example you can subscribe on the exchange and messages from all the queues in that exchange will be sent to you. Same with publishers – many publishers can publish to one queue or exchange at the same time.
Apache Kafka is a distributed streaming service that is used for publishing and subscribing on to streams of messages. Kafka is used for fault tolerant storage. Kafka is designed to allow your applications to process records as they occur.
ActiveMQ translates messages from sender to receiver. It can establish connection between multiple clients and allows messages to be held in queue, instead of requiring both the clients to be available simultaneously in order to communicate.
All three are messaging technologies used to detach the sender and receiver of a message. RabbitMQ, Kafka and ActiveMQ all serve the same purpose, but does the job a bit differently. Kafka is a high-throughput distributed messaging system. RabbitMQ is an AMQP based reliable message broker. ActiveMQ and Kafka are both Apache products, and both written in Java; RabbitMQ is written in Erlang.
So if you decided that RabbitMQ is technology you want to use. Make sure that your RabbitMQ won’t become a single point of failure on your system. How to prevent that is written here.