amqplib implements AMQP 0-9-1 messaging for Node.js, including high- and low-level client APIs. It targets brokers such as RabbitMQ and does not implement AMQP 1.0 or 0-10.
Overview
amqplib provides the protocol machinery and a ready-made client for AMQP 0-9-1 in Node.js. The design layers parsing, framing, connection state, and channel semantics so callers can build different client styles without baking in one opinionated API.
Client APIs center on Channel objects that expose exchanges and queues through method calls, with promise-based and callback variants for most RPC-style operations. Optional connection recovery can reconnect with configurable backoff, separate retry budgets for initial connect versus later drops, and custom delay strategies.
Operators must attach error listeners on connections and channels because unhandled error events can terminate the Node process. Additional handler-error listeners can capture throws from user event callbacks. Documentation covers confirm channels, buffer backpressure on publish, SSL parameters, and compatibility notes for recent RabbitMQ releases.
The project ships tutorial-style examples, API reference material, and troubleshooting guidance for common broker and networking misconfigurations.
Key features
- AMQP 0-9-1 protocol implementation
- Promise and callback client APIs
- Opt-in automatic reconnection
- Configurable reconnect backoff
- Channel-centric messaging model
- RabbitMQ tutorial port examples
- Connection and channel error events
- Separate initial connection retry budget
Use cases
- Node.js producers and consumers for RabbitMQ
- Work queues with AMQP brokers
- Services needing reconnectable AMQP clients