Top Related Projects
Go client for AMQP 0.9.1
Mirror of Apache ActiveMQ
Mirror of Apache Kafka
Apache Pulsar - distributed pub-sub messaging system
High-Performance server for NATS.io, the cloud and edge native messaging system.
The most scalable open-source MQTT broker for IoT, IIoT, and connected vehicles
Quick Overview
RabbitMQ is a widely-used open-source message broker that supports multiple messaging protocols. It facilitates communication between distributed systems and microservices by enabling asynchronous processing and message queuing. RabbitMQ is known for its reliability, scalability, and extensive plugin ecosystem.
Pros
- High performance and scalability, capable of handling millions of messages per second
- Supports multiple messaging protocols (AMQP, MQTT, STOMP) and programming languages
- Offers built-in clustering for high availability and fault tolerance
- Extensive plugin ecosystem for additional features and integrations
Cons
- Can be complex to set up and configure for advanced use cases
- Requires careful tuning and monitoring for optimal performance in high-load scenarios
- Learning curve for developers new to message brokers or AMQP concepts
- Resource-intensive for small-scale applications with low message volumes
Code Examples
- Sending a message:
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_publish(exchange='', routing_key='hello', body='Hello World!')
print("Sent 'Hello World!'")
connection.close()
- Receiving a message:
import pika
def callback(ch, method, properties, body):
print(f" [x] Received {body}")
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_consume(queue='hello', on_message_callback=callback, auto_ack=True)
print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()
- Publishing with routing keys:
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='logs', exchange_type='direct')
channel.basic_publish(exchange='logs', routing_key='error', body='This is an error message')
print("Sent error message")
connection.close()
Getting Started
- Install RabbitMQ server (varies by OS, see official documentation)
- Install the Python client library:
pip install pika
- Run the RabbitMQ server
- Use the code examples above to start sending and receiving messages
For more advanced usage and configuration, refer to the official RabbitMQ documentation.
Competitor Comparisons
Go client for AMQP 0.9.1
Pros of amqp
- Lightweight Go client library for RabbitMQ, focusing on AMQP protocol implementation
- Simpler to use for Go developers who only need AMQP functionality
- More suitable for projects that require direct AMQP integration without full RabbitMQ server
Cons of amqp
- Limited to AMQP protocol, lacking full RabbitMQ feature set
- Requires separate RabbitMQ server installation and management
- Less comprehensive documentation and community support compared to rabbitmq-server
Code Comparison
rabbitmq-server (Erlang):
-module(rabbit_queue).
-behaviour(gen_server2).
-export([start_link/1, declare/5, delete/3]).
amqp (Go):
package amqp
type Connection struct {
Config Config
}
func Dial(url string) (*Connection, error)
The code snippets highlight the different approaches:
- rabbitmq-server implements the full RabbitMQ server in Erlang
- amqp provides a Go client library for AMQP protocol interactions
rabbitmq-server offers a complete message broker solution, while amqp focuses on providing a Go interface for AMQP communication with existing RabbitMQ servers.
Mirror of Apache ActiveMQ
Pros of ActiveMQ
- Supports multiple protocols (AMQP, MQTT, STOMP) out of the box
- Offers more advanced routing capabilities and message selectors
- Provides better integration with Java EE environments
Cons of ActiveMQ
- Generally slower performance compared to RabbitMQ
- More complex configuration and setup process
- Less active community and slower development cycle
Code Comparison
RabbitMQ (Erlang):
basic_publish(Channel, Exchange, RoutingKey, Payload, Options) ->
amqp_channel:call(Channel, #'basic.publish'{
exchange = Exchange,
routing_key = RoutingKey
}, #amqp_msg{payload = Payload, props = Options}).
ActiveMQ (Java):
MessageProducer producer = session.createProducer(destination);
TextMessage message = session.createTextMessage(text);
producer.send(message);
Both RabbitMQ and ActiveMQ are popular message brokers, but they have different strengths. RabbitMQ is known for its simplicity, performance, and strong community support. It excels in scenarios requiring high throughput and low latency. ActiveMQ, on the other hand, offers more flexibility in terms of protocols and advanced routing features, making it suitable for complex enterprise environments. The choice between the two depends on specific project requirements, existing infrastructure, and team expertise.
Mirror of Apache Kafka
Pros of Kafka
- Higher throughput and scalability for large-scale data streaming
- Better support for data retention and replay
- More robust partitioning and distributed processing capabilities
Cons of Kafka
- Steeper learning curve and more complex setup
- Less flexible routing options compared to RabbitMQ
- Heavier resource consumption, especially for smaller deployments
Code Comparison
RabbitMQ (Erlang):
basic_publish(Channel, <<"my_exchange">>, <<"routing_key">>, <<"Hello, World!">>),
{#'basic.deliver'{delivery_tag = Tag}, Content} = basic_consume(Channel, <<"my_queue">>),
basic_ack(Channel, Tag)
Kafka (Java):
producer.send(new ProducerRecord<>("my-topic", "Hello, World!"));
ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(100));
for (ConsumerRecord<String, String> record : records) {
System.out.println(record.value());
}
Both RabbitMQ and Kafka are popular message brokers, but they serve different use cases. RabbitMQ excels in complex routing scenarios and traditional messaging patterns, while Kafka is designed for high-throughput data streaming and log aggregation. The choice between them depends on specific project requirements, scalability needs, and the team's expertise.
Apache Pulsar - distributed pub-sub messaging system
Pros of Pulsar
- Multi-tenancy support with better isolation between tenants
- Geo-replication and disaster recovery features built-in
- Tiered storage for cost-effective data retention
Cons of Pulsar
- More complex setup and configuration compared to RabbitMQ
- Steeper learning curve for developers and operators
- Less mature ecosystem and community support
Code Comparison
RabbitMQ (Erlang):
basic_publish(Channel, <<"my_exchange">>, <<"routing_key">>, <<"Hello, World!">>).
Pulsar (Java):
producer.send("Hello, World!".getBytes());
Both examples show a basic message publishing operation. RabbitMQ uses exchanges and routing keys, while Pulsar uses a simpler topic-based approach.
Key Differences
- Architecture: RabbitMQ uses a traditional message broker model, while Pulsar separates storage and serving layers
- Scalability: Pulsar is designed for higher scalability and throughput
- Protocol support: RabbitMQ supports more protocols out-of-the-box
- Use cases: RabbitMQ excels in traditional messaging scenarios, while Pulsar is better suited for streaming and high-volume data processing
Conclusion
Choose RabbitMQ for simpler setups and traditional messaging needs. Opt for Pulsar when dealing with large-scale, geo-distributed systems or when streaming capabilities are required.
High-Performance server for NATS.io, the cloud and edge native messaging system.
Pros of NATS Server
- Lightweight and high-performance, with lower latency and higher throughput
- Simple to set up and operate, with minimal configuration required
- Supports multiple messaging patterns (pub/sub, request/reply, queueing)
Cons of NATS Server
- Less feature-rich compared to RabbitMQ, with fewer advanced routing options
- Limited persistence and durability options out of the box
- Smaller ecosystem and community support
Code Comparison
NATS Server (Go):
nc, err := nats.Connect(nats.DefaultURL)
if err != nil {
log.Fatal(err)
}
defer nc.Close()
RabbitMQ Server (Erlang):
{ok, Connection} = amqp_connection:start(#amqp_params_network{}),
{ok, Channel} = amqp_connection:open_channel(Connection),
Both examples show basic connection setup, but NATS is generally simpler to use and configure. RabbitMQ offers more advanced features and routing options, which can lead to more complex code for advanced use cases.
The most scalable open-source MQTT broker for IoT, IIoT, and connected vehicles
Pros of EMQX
- Designed specifically for IoT scenarios, offering better scalability for large numbers of concurrent connections
- Supports multiple protocols (MQTT, CoAP, LwM2M) out of the box
- Built-in rule engine for message processing and integration with external systems
Cons of EMQX
- Less mature ecosystem compared to RabbitMQ
- Steeper learning curve for developers not familiar with MQTT or IoT-specific messaging patterns
- Limited support for non-IoT use cases
Code Comparison
EMQX (Erlang):
-module(emqx_broker).
-export([publish/1]).
publish(Message) ->
emqx:publish(Message).
RabbitMQ (Erlang):
-module(rabbit_basic).
-export([publish/3]).
publish(Exchange, RoutingKey, Message) ->
amqp_channel:call(Channel, #'basic.publish'{
exchange = Exchange,
routing_key = RoutingKey
}, Message).
Both projects are written in Erlang, but EMQX focuses on MQTT-specific functionality, while RabbitMQ provides a more general-purpose messaging interface. EMQX's code is often more concise for IoT-related tasks, while RabbitMQ offers more flexibility for various messaging patterns.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
RabbitMQ Server
RabbitMQ is a feature rich, multi-protocol messaging and streaming broker. It supports:
- AMQP 0-9-1
- AMQP 1.0
- RabbitMQ Stream Protocol
- MQTT 3.1, 3.1.1, and 5.0
- STOMP 1.0 through 1.2
- MQTT over WebSockets
- STOMP over WebSockets
Installation
- Currently supported released series
- Installation guides for various platforms
- Kubernetes Cluster Operator
- Changelog
- Releases on GitHub
- Community Support Eligibility Policy
- Supported Erlang versions
Tutorials and Documentation
Some key doc guides include
- CLI tools guide
- Clustering and Cluster Formation
- Configuration guide
- Client libraries and tools
- Monitoring and Prometheus/Grafana
- Upgrading
- Kubernetes Cluster Operator
- Production checklist
- Quorum queues: a replicated, data safety- and consistency-oriented queue type
- Streams: a persistent and replicated append-only log with non-destructive consumer semantics
- Runtime Parameters and Policies
- Runnable tutorials
RabbitMQ documentation is also developed on GitHub.
Commercial Features and Support
- Commercial editions of RabbitMQ
- Commercial edition for Kubernetes
- Commercial support from Broadcom for open source RabbitMQ
Getting Help from the Community
Please read the Community Support Eligibility Policy document first.
The recommended community forums are
- GitHub Discussions
- Community Discord server
#rabbitmq
on Libera Chat
Contributing
See CONTRIBUTING.md and our development process overview.
Questions about contributing, internals and so on are very welcome in GitHub Discussions
or community Discord server in the core-and-plugin-dev
channel.
Licensing
RabbitMQ server is licensed under the MPL 2.0.
Community Support Eligibility Policy document explains the open source RabbitMQ support policy adopted by the RabbitMQ Core Team.
Building From Source and Packaging
Copyright
(c) 2007-2024 Broadcom. All Rights Reserved. The term âBroadcomâ refers to Broadcom Inc. and/or its subsidiaries.
Top Related Projects
Go client for AMQP 0.9.1
Mirror of Apache ActiveMQ
Mirror of Apache Kafka
Apache Pulsar - distributed pub-sub messaging system
High-Performance server for NATS.io, the cloud and edge native messaging system.
The most scalable open-source MQTT broker for IoT, IIoT, and connected vehicles
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot