@cloudamqp/amqp-client
    Preparing search index...

    Class AMQPGeneratorSubscription<P>

    A persistent queue subscription that yields messages via an async iterator. Returned by AMQPQueue.subscribe when no callback is provided.

    Bridges across reconnections — the iterator continues yielding after each reconnect without the caller needing to re-subscribe.

    const sub = await session.subscribe("my-queue", { noAck: true })
    for await (const msg of sub) {
    console.log(msg.bodyString())
    }

    Type Parameters

    Hierarchy (View Summary)

    Implements

    Index

    Properties

    consumer: AMQPConsumer

    Accessors

    • get consumerTag(): string

      The consumer tag. Reflects the most recent tag after a reconnect.

      Returns string

    Methods

    • Cancel the subscription, close its dedicated channel, and remove it from session auto-recovery.

      The subscription owns the channel that queue.subscribe() opened for it, so cancelling here also closes that channel — otherwise each cancelled subscription leaks a channel until the connection drops.

      Best-effort: never throws on wire-level failures. If the channel dropped mid-cancel or the broker is gone, the consumer is already effectively dead — there's nothing for the caller to recover from, so swallowing the error means call sites don't need .catch(() => {}) boilerplate around every cancel.

      Returns Promise<void>