Skip to content
PackagesCommunicationDocs 1.3.x

@connectum/events-amqp ​

AMQP and RabbitMQ adapter with topology, confirms, recovery, and external-contract publishing.

Install ​

bash
npm install @connectum/events-amqp
bash
pnpm add @connectum/events-amqp
bash
bun add @connectum/events-amqp

Start Here ​

typescript
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 pointUse it to
AmqpAdapterConnect EventBus to an AMQP broker.
AmqpAdapterOptionsConfigure connection, topology, publishing, recovery, and publishRetry.
AmqpLifecycleEventObserve the connection through lifecycle.onLifecycle.
isAutoRetriablePublishErrorTell whether a publish failure belongs to the error classes publishRetry retries.
AmqpTopologyErrorIdentify a failed declaration through its object field.
FakeAmqpAdapterTest failure handling without a broker (@connectum/events-amqp/testing).
AmqpRecoveryOptionsBound 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 ​

Compare all Connectum packages by capability.