The in MQ is all about trade-offs. On the one hand, this strange name lowers MQs visibility on Google and Twitter. On the other hand, it annoys the heck out of some Danish folk who write us things like MG rtfl, and is not a funny-looking zero! and Rdgrd med Flde! (which is apparently an insult that means May your neighbours be the direct descendants of Grendel!). Seems like a fair trade.
Originally, the zero in MQ was meant to signify zero broker and (as close to) zero latency (as possible). Since then, it has come to encompass different goals: zero administration, zero cost, zero waste. More generally, zero refers to the culture of minimalism that permeates the project. We add power by removing complexity rather than by exposing new functionality.
How This Book Came to Be
In the summer of 2010, MQ was still a little-known niche library described by its rather terse reference manual and a living but sparse wiki. Martin Sustrik and I were sitting in the bar of the Hotel Kyjev in Bratislava plotting how to make MQ more widely popular. Martin had written most of the MQ code, and Id put up the funding and organized the community. Over some Zlat Baant, we agreed that MQ needed a new, simpler website and a basic guide for new users.
Martin collected some ideas for topics to explain. Id never written a line of MQ code before this, so it became a live learning documentary. As I worked through simple examples to more complex ones, I tried to answer many of the questions Id seen on the mailing list. Because Id been building large-scale architectures for 30 years, there were a lot of problems I was keen to throw MQ at. Amazingly, the results were mostly simple and elegant, even when working in C. I felt a pure joy learning MQ and using it to solve real problems, which brought me back to programming after a few years pause. And often, not knowing how it was supposed to be done, we improved MQ as we went along.
From the start, I wanted the guide to be a community project, so I put it onto GitHub and let others contribute with pull requests. This was considered a radical, even vulgar approach by some. We came to a division of labor: Id do the writing and make the original C examples, and others would help fix the text and translate the examples into other languages.
This worked better than I dared hope. You can now find all the examples in several languages, and many in a dozen languages. Its a kind of programming language Rosetta Stone, and a valuable outcome in itself. We set up a high score: reach 80% translation and your language gets its own guide. PHP, Python, Lua, and Haxe reached this goal. People asked for PDFs, and we created those. People asked for ebooks, and got those. About a hundred people have contributed to the guide to date.
The guide achieved its goal of popularizing MQ. The style pleases most and annoys some, which is how it should be. In December 2010, my work on MQ and the guide stopped, as I found myself going through late-stage cancer, heavy surgery, and six months of chemotherapy. When I picked up work again in mid-2011, it was to start using MQ in anger for one of the largest use-cases imagineable: on the mobile phones and tablets of the worlds biggest electronics company.
But the goal of the guide was, from the start, a printed book. So it was exciting to get an email from Bill Lubanovic in January 2012, introducing me to his editor, Andy Oram, at OReilly, suggesting a MQ book. Of course! I said. Where do I sign? How much do I have to pay? Oh, I get money for this? All I have to do is finish it?
Of course, as soon as OReilly announced a MQ book, other publishers started sending out emails to potential authors. Youll probably see a rash of MQ books coming out next year. Thats good. Our niche library has hit the mainstream and deserves its six inches of shelf space. My apologies to the other MQ authors. Weve set the bar horribly high, and my advice is to make your books complementary. Perhaps focus on a specific language, platform, or pattern.
This is the magic and power of communities: be the first community in a space, stay healthy, and you own that space for ever.
Audience
This book is written for professional programmers who want to learn how to make the massively distributed software that will dominate the future of computing. We assume you can read C code, because most of the examples here are in C (even though MQ is used in many languages). We assume you care about scale, because MQ solves that problem above all others. We assume you need the best possible results with the least possible cost, because otherwise you wont appreciate the trade-offs that MQ makes. Other than that basic background, we try to present all the concepts in networking and distributed computing you will need to use MQ.
Conventions Used in This Book
We used the following typographical conventions in this book:
ItalicIndicates new terms, commands and command-line options, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, data types, and environment variables.
Constant width bold
Shows user input at the command line.
Constant width italic
Shows placeholder user input that you should replace with something that makes sense for you.
Tip
This icon signifies a tip, suggestion, or general note.
Using the Code Examples
The code examples are all online in the repository at https://github.com/imatix/zguide/tree/master/examples/. Youll find each example translated into severaloften a dozenother languages. The examples are licensed under MIT/X11; see the LICENSE file in that directory. The text of the book explains in each case how to run each example.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: