Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RemoteBroker

An implementation of a remote broker, that's it a broker where connection is established over network (although it might run on the same computer).

Hierarchy

  • RemoteBroker

Implements

Index

Constructors

Accessors

Methods

Constructors

constructor

  • Parameters

    • config: IBrokerConfig

      The broker configuration, used to establish new connections to the broker.

    • Default value poolSize: number = 0

      The pool size if connection pooling is to be used.

    Returns RemoteBroker

Accessors

config

name

  • get name(): string
  • The broker name (alias for fail-safe configurations), as set in configuration.

    Returns string

offline

  • get offline(): boolean
  • Flag set if last connection attempt failed, reset after one second so new connection can be attempted in case the broker comes back online.

    Returns boolean

Methods

endConnection

  • endConnection(connection: IConnection): Promise<boolean>
  • Depending on the connection pool size the connection that is done with can be disconnected or kept in the pool for further requests.

    Parameters

    • connection: IConnection

      The API connection.

    Returns Promise<boolean>

getConnection

  • getConnection(): Promise<IConnection>
  • Attempt to establish a new connection to the broker or use one from the connection pool. The promise is resolved with the API connection or rejected if there was a connection error.

    Returns Promise<IConnection>