Convenience class for queues

Constructors

Properties

channel: AMQPChannel
name: string

Methods

  • Bind the queue to an exchange

    Parameters

    • exchange: string
    • routingKey: string = ""
    • args: {} = {}

    Returns Promise<AMQPQueue>

  • Poll the queue for messages

    Parameters

    • params: { noAck?: boolean } = {}
      • OptionalnoAck?: boolean

        automatically acknowledge messages when received

    Returns Promise<null | AMQPMessage>

  • Publish a message directly to the queue

    Parameters

    • body:
          | null
          | string
          | ArrayBuffer
          | Uint8Array<ArrayBufferLike>
          | Buffer<ArrayBufferLike>

      the data to be published, can be a string or an uint8array

    • properties: AMQPProperties = {}

      publish properties

    Returns Promise<AMQPQueue>

    fulfilled when the message is enqueue on the socket, or if publish confirm is enabled when the message is confirmed by the server

  • Subscribe to the queue

    Parameters

    • params: ConsumeParams = ...
      • Optionalargs?: Record<string, any>

        custom arguments

      • Optionalexclusive?: boolean

        if this can be the only consumer of the queue, will return an Error if there are other consumers to the queue already

      • OptionalnoAck?: boolean

        if messages are removed from the server upon delivery, or have to be acknowledged

      • Optionaltag?: string

        tag of the consumer, will be server generated if left empty

    • callback: (msg: AMQPMessage) => void

      Function to be called for each received message

    Returns Promise<AMQPConsumer>

  • Delete a binding between this queue and an exchange

    Parameters

    • exchange: string
    • routingKey: string = ""
    • args: {} = {}

    Returns Promise<AMQPQueue>