RabbitMQ
| Company type | Open-source software |
|---|---|
| Industry | Message broker software |
| Predecessor | Rabbit Technologies Ltd. |
| Founded | 2007 |
| Products | Message broker software implementing AMQP, STOMP, MQTT protocols |
| Parent | VMware |
| Website | www |
RabbitMQ is a message broker software available as open-source, originally designed to implement the Advanced Message Queuing Protocol (AMQP). Its functionality has since been expanded through a plug-in system to accommodate additional protocols such as Streaming Text Oriented Messaging Protocol (STOMP) and MQ Telemetry Transport (MQTT).
Built using the Erlang language atop the Open Telecom Platform framework, RabbitMQ offers capabilities like clustering and failover support. It provides client libraries compatible with all widely used programming languages. The software's source code is distributed under the terms of the Mozilla Public License.
Since November 2020, VMware has released commercial editions that include enterprise-grade features and support, branded as "VMware RabbitMQ OVA," "VMware RabbitMQ," and "VMware RabbitMQ for Kubernetes." Additionally, the open-source version of RabbitMQ is packaged by Bitnami and also commercially distributed for VMware's Tanzu Application Service.
History
The creation of RabbitMQ traces back to Rabbit Technologies Ltd., a collaboration between LShift and CohesiveFT established in 2007. In April 2010, it was acquired by SpringSource, a VMware subsidiary. By May 2013, the project became part of Pivotal Software, which VMware reacquired in December 2019.
Key components of the project include:
- The core RabbitMQ exchange server
- Protocol gateways supporting AMQP, HTTP, STOMP, and MQTT
- AMQP client libraries for Java, .NET, and Erlang (with additional language clients offered commercially)
- A plug-in ecosystem featuring important plug-ins such as:
- "Shovel," enabling message replication between brokers
- "Federation," allowing message exchange at the exchange level
- "Management," providing tools for monitoring and operating brokers and clusters
Examples
This section illustrates example Python scripts utilizing the pika library to send and receive messages through a queue.
Sending
The following script establishes a connection to a local RabbitMQ server, declares a queue to ensure its existence, sends a message to that queue, and then closes the connection.
<syntaxhighlight lang="python">
- !/usr/bin/env python3
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(host="localhost")) channel = connection.channel() channel.queue_declare(queue="hello") channel.basic_publish(exchange="", routing_key="hello", body="Hello World!") print(" [x] Sent 'Hello World!'") connection.close() </syntaxhighlight>
Receiving
This program listens for incoming messages from the specified queue and outputs them upon receipt. Note that it does not send acknowledgments back to the broker.
<syntaxhighlight lang="python">
- !/usr/bin/env python3
import pika
def callback(ch, method, properties, body):
print(" [x] Received %r" % body)
connection = pika.BlockingConnection(pika.ConnectionParameters(host="localhost")) channel = connection.channel() channel.queue_declare(queue="hello") print(" [*] Waiting for messages. To exit press Ctrl+C") channel.basic_consume(queue="hello", on_message_callback=callback) channel.start_consuming() </syntaxhighlight>
See also
Further reading
- Getting started with AMQP and RabbitMQ – InfoQ
- RabbitMQ - A Fast, Reliable Queuing Option for Rubyists – RubyInside
- RabbitMQ: An Open Source Messaging Broker That Just Works – Google Tech Talks