amqplib (Node.js AMQP)
AMQP 0-9-1 client library for Node.js — the standard protocol used by RabbitMQ. amqplib provides both callback and Promise-based APIs (amqplib/channel_api) for connecting to RabbitMQ, declaring exchanges and queues, publishing and consuming messages, and managing acknowledgments. The go-to Node.js library for RabbitMQ integration in agent messaging pipelines.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
TLS/SSL via amqps://. RabbitMQ VHOST isolation for multi-tenant environments. Credentials in connection URL — use environment variables, not hardcoded strings.
⚡ Reliability
Best When
You're integrating Node.js agent services with RabbitMQ for flexible message routing, reliable delivery, and complex exchange/queue topologies.
Avoid When
You don't need RabbitMQ's routing complexity — BullMQ or SQS are simpler for basic job queues. Or if using Kafka for high-throughput streaming.
Use Cases
- • Publish agent task messages to RabbitMQ queues for distributed agent worker consumption with acknowledgment-based delivery
- • Implement topic-based agent event routing with exchange types (direct, topic, fanout, headers) for flexible message distribution
- • Build dead letter queue (DLQ) pipelines for failed agent task handling — messages rejected by agents routed to DLQ for inspection and retry
- • Create durable agent work queues with persistence (durable: true, persistent: true) — messages survive RabbitMQ restarts
- • Use consumer acknowledgments (ack/nack) for at-least-once agent message delivery — prevent message loss on agent crashes
Not For
- • High-throughput streaming scenarios — Kafka is better suited for ordered, replayed, high-throughput event streams
- • Simple job queues without complex routing — BullMQ (Redis-based) is simpler for job queues without RabbitMQ's routing complexity
- • Serverless functions — AMQP connections are long-lived; use SQS or event-driven alternatives for stateless serverless agents
Interface
Authentication
Library — no external auth. RabbitMQ credentials in AMQP URL (amqp://user:pass@host/vhost). TLS support via amqps:// scheme.
Pricing
MIT-licensed open source. RabbitMQ server itself is also open source (MPL 2.0). CloudAMQP provides managed RabbitMQ with paid plans.
Agent Metadata
Known Gotchas
- ⚠ Channel errors close the channel — after a channel error (reject, channel overflow) the channel is unusable; agent code must create a new channel and re-register consumers
- ⚠ Connection and channel are separate objects — connection loss closes all channels; implement reconnection with backoff for both connection and all channel/consumer registrations
- ⚠ consumer tag must be unique per connection — reusing consumer tags after reconnection causes 'PRECONDITION_FAILED' errors; use unique UUID or let RabbitMQ auto-assign
- ⚠ prefetch count (ch.prefetch()) limits unacknowledged messages per consumer — without prefetch, RabbitMQ sends all available messages to one consumer; configure based on agent processing capacity
- ⚠ amqplib is not fork-safe — in Node.js cluster mode or worker threads, each process needs its own AMQP connection; shared connections across workers causes channel corruption
- ⚠ Message delivery mode 2 (persistent) survives broker restart only if the queue is also durable — declaring a transient queue but sending persistent messages provides false durability
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for amqplib (Node.js AMQP).
Scores are editorial opinions as of 2026-03-06.