Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RabbitMQConsumer

A stream of messages from a rabbitmq queue.

Hierarchy

  • RabbitMQConsumer

Implements

  • any

Index

Methods

cancel

  • cancel(): PromiseLike<void>
  • cancel(cancelResult: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Stop message consumption from a queue.

    The operation is asynchronous. When consumption is stopped, you can also be notified via {@link RabbitMQConsumer#endHandler}

    Returns PromiseLike<void>

  • Stop message consumption from a queue.

    The operation is asynchronous. When consumption is stopped, you can also be notified via {@link RabbitMQConsumer#endHandler}

    Parameters

    • cancelResult: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

consumerTag

  • consumerTag(): string
  • Returns string

endHandler

  • endHandler(endHandler: ((res: void) => void) | Handler<void> | null | undefined): RabbitMQConsumer
  • Set an end handler. Once the stream has canceled successfully, the handler will be called.

    Parameters

    • endHandler: ((res: void) => void) | Handler<void> | null | undefined

    Returns RabbitMQConsumer

exceptionHandler

  • exceptionHandler(exceptionHandler: ((res: Throwable) => void) | Handler<Throwable> | null | undefined): RabbitMQConsumer
  • Set an exception handler on the read stream.

    Parameters

    • exceptionHandler: ((res: Throwable) => void) | Handler<Throwable> | null | undefined

    Returns RabbitMQConsumer

fetch

  • Fetch the specified amount of elements. If the ReadStream has been paused, reading will recommence with the specified amount of items, otherwise the specified amount will be added to the current stream demand.

    Parameters

    • amount: number

    Returns RabbitMQConsumer

handler

  • Set a message handler. As message appear in a queue, the handler will be called with the message.

    Parameters

    Returns RabbitMQConsumer

isCancelled

  • isCancelled(): boolean
  • Return true if cancel() has been called.

    Returns boolean

isPaused

  • isPaused(): boolean
  • Returns boolean

pause

  • Pause the stream of incoming messages from queue.

    The messages will continue to arrive, but they will be stored in a internal queue. If the queue size would exceed the limit provided by , then incoming messages will be discarded.

    Returns RabbitMQConsumer

pipe

  • Returns Pipe<RabbitMQMessage>

pipeTo

  • pipeTo(dst: WriteStream<RabbitMQMessage>): PromiseLike<void>
  • pipeTo(dst: WriteStream<RabbitMQMessage>, handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Parameters

    Returns PromiseLike<void>

  • Parameters

    • dst: WriteStream<RabbitMQMessage>
    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

queueName

  • queueName(): string
  • Returns string

resume

  • Resume reading from a queue. Flushes internal queue.

    Returns RabbitMQConsumer

setQueueName

  • Set the name of the queue. This method is typically only required during a connectionEstablishedCallback when the queue name has changed.

    Parameters

    • name: string

    Returns RabbitMQConsumer

Generated using TypeDoc