I have been working with RabbitMQ for a few years now, but most of the time I just worked with the basic concepts, but recently I had to to work on a RabbitMQ upgrade and also in converting our classical queues to quorum queues and I picked this book to review my knowledge and learn a few new things in order to do a better job on my tasks

The book explains well the basics and also shows some advanced concepts.

This post of Learning is from a technical book, so it may be a bit different than the other posts of the collection Learnings from books, as when I read technical books I focus more on the parts that I looking to learn and for my current situation.

Learnings from The RabbitMQ in Depth

The book has a lot of learnings, but to not be too long a post, I will share my 5 most important learnings from the book.

Only a reference of the message is added to the queue

Rather than placing the actual message in a queue data structure, a reference to the message is included in the queue. When RabbitMQ is prepared to transmit the message, it utilizes this reference to assemble the serialized message and send it. This approach offers a significant optimization for messages distributed to multiple queues since maintaining only one message instance conserves physical memory when it’s dispatched to multiple destinations.

How does RabbitMQ rate limit the publisher

Instead of employing a polite request to the publisher to halt, RabbitMQ ceases to accept low-level data via the TCP socket. This approach effectively shields RabbitMQ from being inundated by a single publisher.

Internally, RabbitMQ employs a credit system to regulate when it will push back against a publisher. Upon establishing a new connection, the connection is allocated a predefined set of credits for its use. Subsequently, as each RPC command reaches RabbitMQ, a credit is subtracted. After processing the RPC request internally, the connection’s credit is reinstated. RabbitMQ evaluates a connection’s credit balance to determine whether it should read from the connection’s socket. If a connection runs out of credits, it is simply bypassed until it accumulates enough credits.

Redelivered flag contains useful information

When a message is requeued, it marks the message with a redelivered flag, indicating to the next consumer that it has been delivered before. If you’re unsure whether the issue lies with the message or another aspect of the consumer, checking the redelivered flag is a useful method to decide whether to reject the message for requeuing or discard it when encountering an error.

RabbitMQ outsource a lot of the work to Erlang

As both a programming language and a runtime system, Erlang emphasizes the use of lightweight processes that communicate through message passing, ensuring a high degree of concurrency without a shared state.

Within a RabbitMQ cluster, servers leverage Erlang’s inter-process communication (IPC) system. This approach alleviates the need to implement extensive clustering capabilities, a requirement in many other competing message broker systems.

One connection, multiple channels

One AMQP connection has the capability to host multiple channels, facilitating numerous interactions between a client and server. In technical jargon, this is referred to as multiplexing, and it proves valuable for applications that are multithreaded or asynchronous, handling multiple tasks concurrently.


These are my 5 most important learnings from the book RabbitMQ in Depth written by Gavin M. Roy.

Happy coding!