@connectum/events-amqp
AMQP and RabbitMQ adapter with topology, confirms, recovery, and external-contract publishing.
Install
npm install @connectum/events-amqppnpm add @connectum/events-amqpbun add @connectum/events-amqpStart Here
import { AmqpAdapter } from '@connectum/events-amqp';
const adapter = AmqpAdapter({
url: 'amqp://localhost:5672',
exchange: 'events',
exchangeType: 'topic',
});The package depends on amqplib ^2.2.0; connection recovery and the reconnect backoff come from amqplib's built-in recovery. For production settings, continue with Run the AMQP adapter reliably.
Key Entry Points
| Entry point | Use it to |
|---|---|
AmqpAdapter | Connect EventBus to an AMQP broker. |
AmqpAdapterOptions | Configure connection, topology, publishing, recovery, and publishRetry. |
AmqpLifecycleEvent | Observe the connection through lifecycle.onLifecycle. |
isAutoRetriablePublishError | Tell whether a publish failure belongs to the error classes publishRetry retries. |
AmqpTopologyError | Identify a failed declaration through its object field. |
FakeAmqpAdapter | Test failure handling without a broker (@connectum/events-amqp/testing). |
AmqpRecoveryOptions | Bound the initial connect (initialConnectMaxRetries) and set the reconnect delay schedule, including a custom backoff hook (since 1.3.0). See Set your own reconnect delay. |
Reliable Publishing
publish() resolves on broker confirmation. A retry after a lost confirmation can duplicate a message; see Reliable publishing for retry policy and deduplication guidance.
Connection Recovery
The adapter reconnects and restores topology and subscriptions by default. Recovery limits, fatal topology errors, and the behavior after recovery stops are documented in Connection recovery.
Tuning the Reconnect Backoff
The backoff option customizes reconnect delays; see Tuning the reconnect backoff for its parameters and examples.
Adapter Lifecycle
The lifecycle.onLifecycle callback reports connection and consumer events. Flat callbacks are deprecated; see Adapter lifecycle for event names, callback behavior, and migration guidance.
Testing
The @connectum/events-amqp/testing subpath exports the in-memory FakeAmqpAdapter; see Testing.
Learn / Configure / API Reference
- Learn: Choose an event adapter
- Configure: Run the AMQP adapter reliably
- Upgrade: events-amqp 1.3 behavior changes
- API reference: Exact options and symbols
- Package API index: Generated TypeDoc
- Source: @connectum/events-amqp on GitHub
Related Modules
Compare all Connectum packages by capability.