Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MessageConsumer<T>

An event bus consumer object representing a stream of message to an EventBus address that can be read from.

The {@link EventBus#consumer} or {@link EventBus#localConsumer} creates a new consumer, the returned consumer is not yet registered against the event bus. Registration is effective after the {@link MessageConsumer#handler} method is invoked.

The consumer is unregistered from the event bus using the {@link MessageConsumer#unregister} method or by calling the {@link MessageConsumer#handler} with a null value..

Type parameters

  • T

Hierarchy

  • MessageConsumer

Implements

Index

Methods

address

  • address(): string
  • Returns string

bodyStream

  • Returns ReadStream<T>

completionHandler

  • completionHandler(): PromiseLike<void>
  • completionHandler(completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Optional method which can be called to indicate when the registration has been propagated across the cluster.

    Returns PromiseLike<void>

  • Optional method which can be called to indicate when the registration has been propagated across the cluster.

    Parameters

    Returns void

endHandler

  • Parameters

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

    Returns MessageConsumer<T>

exceptionHandler

fetch

  • Parameters

    • amount: number

    Returns MessageConsumer<T>

getMaxBufferedMessages

  • getMaxBufferedMessages(): number
  • Returns number

handler

  • Parameters

    Returns MessageConsumer<T>

isRegistered

  • isRegistered(): boolean
  • Returns boolean

pause

pipe

  • Pause this stream and return a to transfer the elements of this stream to a destination .

    The stream will be resumed when the pipe will be wired to a WriteStream.

    Returns Pipe<Message<T>>

pipeTo

  • Pipe this ReadStream to the WriteStream.

    Elements emitted by this stream will be written to the write stream until this stream ends or fails.

    Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

    Parameters

    Returns PromiseLike<void>

  • Pipe this ReadStream to the WriteStream.

    Elements emitted by this stream will be written to the write stream until this stream ends or fails.

    Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

    Parameters

    Returns void

resume

setMaxBufferedMessages

  • Set the number of messages this registration will buffer when this stream is paused. The default value is 1000.

    When a new value is set, buffered messages may be discarded to reach the new value. The most recent messages will be kept.

    Parameters

    • maxBufferedMessages: number

    Returns MessageConsumer<T>

unregister

  • Unregisters the handler which created this registration

    Returns PromiseLike<void>

  • Unregisters the handler which created this registration

    Parameters

    Returns void

Generated using TypeDoc