Skills2026年4月11日·1 分钟阅读

RabbitMQ — Reliable Open-Source Message Broker

RabbitMQ is one of the most popular open-source message brokers, implementing AMQP, MQTT, STOMP, and more. Used by thousands of companies for reliable async messaging, RPC, pub/sub, task queues, and microservice communication.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
step-1.md
直接安装命令
npx -y tokrepo@latest install 90136d3b-35f6-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

TL;DR
RabbitMQ is a mature open-source message broker implementing AMQP, MQTT, and STOMP for reliable async communication.
§01

What it is

RabbitMQ is one of the most widely deployed open-source message brokers. Built on Erlang/OTP, it implements the Advanced Message Queuing Protocol (AMQP) as its primary protocol and also supports MQTT, STOMP, HTTP, and WebSocket. It handles async messaging, task queues, pub/sub patterns, RPC, and microservice communication.

RabbitMQ suits backend teams that need reliable message delivery between services. It runs on Linux, macOS, and Windows, with official Docker images and Kubernetes operators available.

§02

How it saves time or tokens

RabbitMQ decouples producers from consumers, letting services scale independently. Instead of polling or blocking on synchronous HTTP calls, services push messages to queues and move on. Failed consumers retry automatically with configurable dead-letter exchanges. This eliminates manual retry logic and reduces wasted compute on failed operations.

§03

How to use

  1. Run RabbitMQ with Docker using the management plugin for the web UI.
  2. Connect a producer using the pika library (Python) or any AMQP client.
  3. Connect a consumer that processes messages and acknowledges them.
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 \
  -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin \
  rabbitmq:3-management
§04

Example

A Python producer sending a persistent message to a durable queue:

import pika

conn = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = conn.channel()
channel.queue_declare(queue='tasks', durable=True)

channel.basic_publish(
    exchange='',
    routing_key='tasks',
    body='process order 42',
    properties=pika.BasicProperties(delivery_mode=2),
)
conn.close()

A consumer processing and acknowledging messages:

def callback(ch, method, properties, body):
    print(f'Received {body}')
    ch.basic_ack(delivery_tag=method.delivery_tag)

channel.basic_qos(prefetch_count=1)
channel.basic_consume(queue='tasks', on_message_callback=callback)
channel.start_consuming()
§05

Related on TokRepo

§06

Common pitfalls

  • Forgetting to set durable=True on queues and delivery_mode=2 on messages means data loss on restart.
  • The default guest user only works from localhost. Remote connections need a new user created via rabbitmqctl add_user.
  • Unacknowledged messages accumulate in memory. Always set prefetch_count to limit how many messages a consumer holds at once.

常见问题

What protocols does RabbitMQ support?+

RabbitMQ primarily implements AMQP 0.9.1 and also supports AMQP 1.0, MQTT (for IoT), STOMP (for text-based messaging), HTTP, and WebSocket. Each protocol is enabled through a plugin. AMQP is enabled by default.

How does RabbitMQ compare to Kafka?+

RabbitMQ is a message broker focused on routing and delivery guarantees. Kafka is a distributed log optimized for high-throughput event streaming. Use RabbitMQ for task queues, RPC, and complex routing. Use Kafka for event sourcing, log aggregation, and stream processing.

Can RabbitMQ handle high throughput?+

Yes. A single RabbitMQ node handles tens of thousands of messages per second. Clustering and sharded queues scale horizontally. Quorum queues provide replication across nodes for durability without sacrificing throughput.

Is RabbitMQ free to use?+

Yes. RabbitMQ is open source under the Mozilla Public License 2.0. It is free to run and self-host. VMware (Broadcom) offers commercial support and a managed cloud service called CloudAMQP for teams that prefer not to operate it themselves.

What languages have official RabbitMQ client libraries?+

RabbitMQ provides official client libraries for Java, .NET, Erlang, and Go. Community-maintained clients exist for Python (pika), Node.js (amqplib), Ruby (bunny), PHP, Rust, and many others. Any AMQP-compliant library works.

引用来源 (3)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产