@gibme/rabbitmq
    Preparing search index...

    Class RabbitMQ

    Hierarchy

    • EventEmitter
      • RabbitMQ
    Index

    Constructors

    Properties

    options: RabbitMQ.Options
    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>

    • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the event listener to the beginning of the listeners array.

      import { EventEmitter } from 'node:events';
      const myEE = new EventEmitter();
      myEE.on('foo', () => console.log('a'));
      myEE.prependListener('foo', () => console.log('b'));
      myEE.emit('foo');
      // Prints:
      // b
      // a

      Parameters

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

        The callback function

      Returns this

      v0.1.101

    • Parameters

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

      Returns this

    • Parameters

      • event: "log"
      • listener: (entry: string | Error) => void

      Returns this

    • Type Parameters

      • T

      Parameters

      • event: "message"
      • listener: (queue: string, message: Message, payload: T) => 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
      • Optionalprefetch: 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<ArrayBufferLike> | PayloadType
      • Optionaloptions: Publish

      Returns Promise<boolean>

    • Protected

      Creates a new formatted UUID

      Returns string