A lot of modern systems are created on the basis of microservice architecture, where each service handles a specific task. Another type is decentralized systems, which have no central point where decisions are made. In these case, systems need a way to make all of their nodes to communicate with each other by a consistent application programming interface. Such an interface is provided by message-oriented middleware or, in other words, software that supports sending and receiving messages between distributed or fully decentralized systems.
In the market, there are quite a lot of providers of message-oriented middleware. In this article, we will compare ActiveMQ, RabbitMQ and ZeroMQ.
ZeroMQ is a messaging queue library that allows developing complicated communication decisions using API. Usually, an application system works efficiently, but any attempt to add functionality or universalize it by modifying the basic elements of the system leads to performance degradation. It’s not about MQ systems.
ZeroMQ successfully implemented a compromise between functionality and efficiency. The main features of this library:
Written in: C++
Who uses: AT&T, Cisco, EA, Los Alamos Labs, NASA, Weta Digital, Zynga, Spotify, Samsung Electronics, Microsoft, and CERN.
Protocols: TCP, inproc, PGM (reliable multicast), IPC, TIPC (Ericsson’s protocol), NORM (also reliable multicast), and SOCKS5, which allows running over Tor.
Most of ZeroMQ engines use TCP. ZeroMQ supports UDP Unicast and Multicast modes since version 4.2.
Brokers: ZeroMQ is a distributed middleware, but at the same time it has a broker, that is called Malamute. Malamute can be used in cases where a user of ZeroMQ needs a central entity to hold mail, abstract services, and something like that. The broker is quite lightweight and can run as a thread in another process. The Malamute broker offers mailboxes, service calls and topic-based PUB-SUB pattern.
Training: Pieter Hintjens workshops in ZeroMQ
Synchronous/asynchronous: Asynchronous (with queues)
Basic message patterns: Req and Rep, Pub-Sub, Req and Router, Dealer and Rep, Dealer and Router, Dealer and Dealer, Router and Router, Push and Pull, Pair and Pair
Future Directions: “ZeroMQ has no roadmaps, no feature requests, no lists of Things We Could Do, no regular meetings, no Central Planning Committees. ZeroMQ does make a promise though: it will not break userspace. You’ll find ZeroMQ v2, v3 and v4 apps talking to each other in the same universe. This is unusual for a technology that evolves as fast as ZeroMQ does. The tactic is, as often, quite simple. We add new APIs, leave old ones, deprecate them, remove them over time, and never reuse them.”
Main Concept: A high-performance asynchronous messaging library.
The Zen of Zero. “The Ø in ZeroMQ is all about tradeoffs. On the one hand, this strange name lowers ZeroMQ’s visibility on Google and Twitter. On the other hand, it annoys the heck out of some Danish folk who write us things like “ØMG røtfl”, and “Ø is not a funny looking zero!” and “Rødgrød med fløde!”, 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 ZeroMQ was meant as “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.”
RabbitMQ is one of the most popular open source message brokers. Unlike ZeroMQ, which is embedded in applications, RabbitMQ is an intermediary service. It differentiates access rights, supports encryption, storing messages to disk (to survive a planned outage), work in clusters, and even duplication of services for increased survivability. Иesides, it is implemented on the Erlang / OTP platform, which guarantees maximum stability and scalability of the queue, as a key node of the entire system.
Who uses: Reddit, Vine, CircleCI, Trivago, 9GAG, Code School, 500px, HeadHunter
Protocols: AMQP, STOMP, MQTT, HTTP.
Brokers: Only broker
Tools: The RabbitMQ HTTP-based management plugin and Rabbitmqadmin – browser-based UI and a command line tool.
Training: LearnQuest and Open Source Architect, Erlang Solutions, Pivotal Software.
Cost: Free, but there is a commercial release of RabbitMQ. This includes all of the features of the open source version under a commercial license.
Synchronous/asynchronous: Provides both synchronous and asynchronous methods.
Basic message patterns: Message Queue, PUB-SUB, ROUTING, RPC (similar to REQ-REP, but not the same).
Main concept: RabbitMQ is a messaging broker, implementing low-level AMQP protocol and Producer-Consumer pattern. It is intermediary between two applications when in the procedure of processing communication.
Future Directions: The RabbitMQ developers team make constant releases, fixing bugs and improving performance. All the release notes can be found in the RabbitMQ’s changelog.
The RabbitMQ developers encourage all users to upgrade to the latest releases.
Developer: Pivotal Software
Apache ActiveMQ is a message-oriented middleware that makes use of JMS (Java Message Service), which is a standard for messaging software. It provides a lot of features, such as clustering, message storage with the ability to use a variety of databases, caching and logging. Also, it’s important to know that Amazon offers Amazon MQ, which is an implementation of ActiveMQ, integrated into AWS.
Multiple languages: Yes (C#, C, C++, Erlang, Go, Haskell, Haxe, Jekejeke Prolog, NetLogo, Node.js, Perl, Pike, Python, Racket, Ruby on Rails).
Who uses: FuseSource, Dopplr, gnip, RomTrac, University of Washington, CSC, STG Technologies.
Protocols: AMQP, AUTO, MQTT, OpenWire, REST, RSS and Atom, Stomp, WSIF, WS Notification, XMPP, WebSocket.
Brokers: Can be deployed with both broker and P2P topologies.Administration: In case of broker there is an administration tool, Web Console. It is web-based.
Synchronous/asynchronous: Synchronous by default. But if a user wants asynchronous calls, he can set the useAsyncSend property on the ActiveMQConnectionFactory or set the property using the URI when he connects to the broker.
Training: Attune, NobleProg, TytoEASE, Tomitribe, Savoir Technologies.
Cost: Free, but it has a commercial release of RabbitMQ. This version includes all the features of the open source one but is covered by a commercial license.
Basic message patterns: Message Queue, Pub-Sub.
Main concept: One of the most often used open source products for messaging. ActiveMQ is commonly used in enterprise projects, due to its support of advanced features such as multiple instances for storing messages, and clustering environments.
The basis of ActiveMQ is JMS – the Java Messaging Service. JMS is an API implementation within J2EE (Java Enterprise).
Future Directions: The latest direction of the ActiveMQ developers team is moving forward to project Artemis, but now the development of both ActiveMQ and Artemis continues in parallel this decision has not been made yet as you can see on Apache website and for now the development of both ActiveMQ and Artemis continues in parallel.
Developer: Apache Software Foundation