Hierarchy

  • EventEmitter
    • RabbitMQ

Constructors

Properties

replyQueue: string = ...

Accessors

  • get connected(): boolean
  • Returns if the server is connected

    Returns boolean

Methods

  • Acknowledges the receipt of a message from the server This should only be called on messages that have successfully processed or that you want to remove from the queue so that it is not retried again

    Parameters

    • message: Message

    Returns Promise<void>

  • Protected

    Builds the connection string from the options

    Parameters

    Returns string

  • Cancels the specified consumer

    Parameters

    • consumerTag: string

    Returns Promise<void>

  • Closes the connection to the server

    Returns Promise<void>

  • Connects to the RabbitMQ server

    Returns Promise<void>

  • Creates a new message queue on the server

    Parameters

    • queue: string
    • durable: boolean = true
    • exclusive: boolean = false

    Returns Promise<void>

  • Deletes a message queue from the server

    Parameters

    • queue: string

    Returns Promise<void>

  • No-Acknowledges the receipt of a message from the server his should only be called on messages that have not successfully processed or that you do not want to remove from the queue so that it is attempted again

    Parameters

    • message: Message
    • requeue: boolean = true

    Returns Promise<void>

  • Parameters

    • event: "disconnect"
    • listener: ((error) => void)
        • (error): void
        • Parameters

          • error: Error

          Returns void

    Returns this

  • Parameters

    • event: "connect"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "log"
    • listener: ((entry) => void)
        • (entry): void
        • Parameters

          • entry: string | Error

          Returns void

    Returns this

  • Type Parameters

    • T

    Parameters

    • event: "message"
    • listener: ((queue, message, payload) => void)
        • (queue, message, payload): void
        • Parameters

          • queue: string
          • message: Message
          • payload: T

          Returns void

    Returns this

  • Sets our RabbitMQ channel to prefetch such that it limits how many unacknowledged messages we can hold in our specific RabbitMQ channel

    Parameters

    • count: number

    Returns Promise<void>

  • Registers a consumer of messages on the channel for the specified queue

    Type Parameters

    • PayloadType = any

    Parameters

    • queue: string
    • Optional prefetch: number

    Returns Promise<string>

  • Replies to the given message with the response payload specified

    Type Parameters

    • PayloadType = any

    Parameters

    • message: Message
    • payload: PayloadType
    • noAck: boolean = false

      if true, we will not automatically reply to the message with ack/nack

    • requeue: boolean = true

      by default, we requeue the message we are replying to, if we do not want to requeue, set to false

    Returns Promise<boolean>

  • Sends a message to the specified queue requesting that we receipt a reply from the worker that handles the message. This method will wait for the worker to complete the request and the reply is received before the promise will resolve

    Type Parameters

    • PayloadType = any
    • ResponseType = any

    Parameters

    • queue: string
    • payload: PayloadType
    • timeout: number = 15_000

      the amount of time (ms) that we are willing to wait for a reply. If timeout is 0, will wait indefinitely

    • useOneTimeQueue: boolean = false

      whether we should use a one-time use queue to receive the reply (this may be necessary in some use cases)

    Returns Promise<ResponseType>

  • Sends a payload to the specified queue for processing by a consumer

    Type Parameters

    • PayloadType = any

    Parameters

    • queue: string
    • payload: Buffer | PayloadType
    • Optional options: Publish

    Returns Promise<boolean>

  • Protected

    Creates a new formatted UUID

    Returns string