Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Publisher

Used for setting up or ensuring required RabbitMQ internal structure and publishing messages.

Hierarchy

  • Publisher

Implements

Index

Constructors

constructor

Methods

actionsStream

  • actionsStream(): BehaviorSubject<string>
  • Returns a stream of publisher's actions. Contains logs about sent messages as items. Any errors the publisher ends up with will be accessible with this stream.

    Returns BehaviorSubject<string>

closeChannel

  • closeChannel(): Promise<void>

getActiveChannel

  • getActiveChannel(): Channel

getActiveConfigs

getActiveConnection

  • getActiveConnection(): Connection

init

  • Initializes publisher instance and sets up internal RabbitMQ structure either with configs object, or with custom setup function. Prefers function if has both options supplied.

    Parameters

    Returns Promise<void>

publishMessage

  • publishMessage(message: Buffer, routingKey?: string, options?: any): Promise<void>
  • Publishes messages to RabbitMQ.

    throws

    RabbitMqPublisherConfirmationError

    Parameters

    • message: Buffer

      message to publish in form of Node's Buffer

    • Optional routingKey: string

      optional routing key to attach to your message

    • Optional options: any

      options to publish with message with. Can be found in amqplib

    Returns Promise<void>

reconnect

  • reconnect(): Observable<void>
  • Reconnects to the server. Retries given or default (infinite) amount of times. Return an observable that completes when connection is established again.

    Returns Observable<void>

setConfigs

  • Sets publisher configs. Accessible to users, but should only be used by PublisherFactory.

    Parameters

    Returns void

setCustomSetupFunction

Generated using TypeDoc