We now present a new, in-depth exploration of RabbitMQ itself, digging deep under the surface by examining things like how the Advanced Message Queuing Protocol is structured, progressive exploration into the various exchanges, and examination of various performance aspects. RabbitMQ in Depth aims to take your understanding of RabbitMQ to a new level, enabling you to further apply this knowledge in real-world applications today.
Acknowledgments
This book has been some time in the making, and so first and foremost a big thank you goes out to all of our families and friends who tirelessly stood by us all, put up with us, and made those late evening coffees to keep us going through the many additional long hours of work required to write such a book thank you!
To Alvaro Videla and Jason J.W. Williams, authors of RabbitMQ in Action (also published by Manning Publications, in April 2012), for laying the foundation for countless developers insight and interest in RabbitMQ itself.
To Karen, our development editor, for her endless patience and understanding with us all over this entire period, plus the entire Manning team for the fantastic effort involved by all to finally get us to this point. It was hard work, and we ended up doing a fair few rounds, but we are grateful for the solid production effort which has emerged as a result!
Thanks, too, to technical proofreader, Karsten Strbk, whose contribution helped the book immensely, as did the comments of the reviewers: Phillip Warner, Jerry Kuch, Nadia Saad Noori, Bruce Snyder, Robert Kielty, Milos Milivojevic, Arathi Maddula, Ian Dallas, George Harley, Dimitri Aivaliotis, Hechen Gao, Stefan Turalski, Andrew Meredith, Artem Dayneko, David Paccoud, Barry Alexander, Biju Kunjummen, Adolfo Prez lvarez, Brandon Wilhite, David Pull, and Ray Lugo.
There are a great many others which have helped contribute in various ways to this book as well. We cannot mention everyone by name as this would just mean the acknowledgements roll on and on, but a big thank you goes out to everyone else who had a hand in helping make this possible!
About This Book
RabbitMQ is an open source message broker written in Erlang, currently under the wing of Pivotal Software. Its based around the AMQP open protocol, with official client libraries in Java, .NET, Erlang, as well as libraries for most other popular programming languages.
This book is up-to-date with RabbitMQ 3.6.3, so with the erratic release schedule of RabbitMQ itself, by the time this book reaches you there may be newer versions released. Not to fret though, as in our experience RabbitMQ has rarely broken features with releases, only added new features and fixed issues!
The code examples used throughout the book are written with Python, but if you dont have a working setup with Python and RabbitMQ, or youd just like to experiment without setting up the whole environment, weve included instructions on setting up a Vagrant box with everything pre-installed. Make sure you check out the appendix for instructions on how to get this up and running first.
Road Map
looks at the foundation of RabbitMQ: the various features of RabbitMQ itself and the foundation of RabbitMQ, the Advanced Messaging Queuing model.
explores the AMQ protocol, looking at the frame structure, and the low-level process that occurs when a message is published or retrieved from RabbitMQ.
goes even further and looks at the message properties, including the headers that add important meta-data to messages, such as content-type and encoding, and how you can leverage these headers in your applications.
considers performance trade-offs which must be made. With each level of guarantee, your applications risk taking a hit on performance. This chapter explores what these options are and will help you balance your environments need for guaranteed message assurance versus lightning fast delivery, the Goldilocks Principle.
explores the concept of consuming messages, looking at the fundamental difference between Basic.Get and Basic.Consume at a low level (and why the latter is usually better), as well as pre-fetching and Quality of Service, message acknowledgements, dead letter exchanges, temporary queues, and message expiry.
takes an in-depth look into the four core exchange types in RabbitMQ and how they can benefit your application architecture.
looks at how you can scale up RabbitMQ by managing clusters, crash recovery in a cluster, and further performance considerations when working with a clustered environment.
builds on the core concepts of clustering by taking a look at federated exchanges and queues, integrating RabbitMQ clusters with Amazon Web Services, and applying policies.
looks at other ways of talking to RabbitMQ: using MQTT and STOMP as alternative protocols, or using statelessd-based HTTP messaging.
Finally, looks at database integration into both PostgreSQL and InfluxDB for further interesting integrations.
Code
Just about all of the code shown in the book can be found in various forms in the sample source code which accompanies this book. The sample code can be downloaded free of charge from the Manning website (https://www.manning.com/books/rabbitmq-in-depth), as well as from this Github repository: https://github.com/gmr/RabbitMQ-in-Depth.