Author: Alvaro Vileda & Jason Williams
Audience: Developers wanting to write apps that use asynchronous messaging
Reviewer: Kay Ewbank
Down-to-earth and lucid coverage of messaging but be prepared for some groan-worthy puns about rabbits.
Using middle-tier messaging software can be a great way to hand over some of the tough bits of writing an app, but the process is far from transparent. Big name products like IBM MQSeries and Microsoft MSMQ have their fans, but so does the open source RabbitMQ server. RabbitMQ is written in Erlang, and conforms to the AMQP specification (Advanced Message Queuing Protocol). We’ve all used software that makes use of asynchronous messaging - email, instant messengers, software such as Skype all relies on asynchronous messaging. What’s less obvious is how and why it would be useful in your own applications.
Vileda and Williams start with a general introduction to the subject matter, and for once this isn’t a waste of space.
They make the case for using asynchronous messaging by pointing out that the applications we write need to have easy ways to route information to multiple receivers, and to change who receives the information without rewriting the whole app. Having set out the case for why messaging is important, they go on to give a short history of messaging and RabbitMQ before going through the basics of messaging - consumers and producers; exchanges and queues; and the use of virtual hosts. Even if you don’t intend to use RabbitMQ, these two chapters will give you a good understanding of what messaging is and why it matters.
Chapter 3 moves on to the mechanics of running and administering RabbitMQ, essentially covering starting and stopping server nodes, managing permissions, and some troubleshooting. From this point on the book becomes more useful. It also from here onwards contains a lot of code.
There’s a good chapter on solving problems with RabbitMQ coding and patterns where the authors look at how to design your apps to be ‘messaging friendly’ before going on to look at different patterns that apps using messaging fall into, finishing with a look at RPC with RabbitMQ. The next chapter looks at clustering to make your system resistant to failures. This is an interesting chapter in terms of the different approaches discussed, and is refreshingly down-to-earth and doable. Far too often once authors start talking about clustering and distributed systems the picture that springs to mind involves extremely large systems paid for by extremely large amounts of money, but these guys talk about clustering on your laptop! Much more believable. The following chapter is also dedicated to writing code that survives failure, with coverage of load balancing and how to write code that reconnects and survives failure.
The title of the next chapter "Warrens and Shovels" had me puzzled for a few minutes till I read far enough to realize the authors were making a groan-worthy joke about having active/standby pairs of servers, and that Shovel is the name of a plug-in for RabbitMQ that replicates queues across servers.
RabbitMQ has a management plug-in that you can use to manage your servers from the Web, and the next chapter is all about how to use this. You can also control RabbitMQ with its own RabbitMQ REST API, and that gets its own chapter.
Chapter 10 is titled "Houston, we have a problem", and looks at monitoring. You may have concluded by now that Vileda and Williams are pessimists at heart who expect everything to fail. On the other hand, you may well think they’re just realists. The final two chapters are for optimists, though. The first looks at supercharging and securing RabbitMQ, including using SSL connections. The last chapter covers extending RabbitMQ both by using existing plugins and by creating your own plugins.
I liked this book.
The authors have a terrible liking for puns and I groaned far too often at their rabbit jokes, but I could live with that. The code is interesting, and the coverage of RabbitMQ is good. I’m not sure they completely convinced me that RabbitMQ is the message queue manager to beat all others, but no matter what software you’re contemplating using the book covers the underlying ideas in a very understandable way.