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

    Class AMQPGeneratorConsumer

    A consumer, subscribed to a queue

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    channel: AMQPChannel

    Channel this consumer is attached to.

    closed: boolean = false
    closedError?: Error
    onMessage: (msg: AMQPMessage) => void | Promise<void>

    Callback invoked for each delivered message.

    tag: string

    Server-assigned consumer tag.

    Accessors

    • get messages(): AsyncGenerator<AMQPMessage, void, undefined>

      Get an AsyncGenerator for consuming messages.

      Returns AsyncGenerator<AMQPMessage, void, undefined>

      An AsyncGenerator that yields messages

    Methods

    • Cancel/abort/stop the consumer. No more messages will be deliviered to the consumer. Note that any unacked messages are still unacked as they belong to the channel and not the consumer. Safe to call multiple times — concurrent calls share the same underlying wire operation.

      Returns Promise<AMQPChannel>

    • Wait for the consumer to finish.

      Parameters

      • Optionaltimeout: number

        wait for this many milliseconds and then return regardless

      Returns Promise<void>

      Fulfilled when the consumer/channel/connection is closed by the client. Rejected if the timeout is hit.