Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MemoryDiscovery

Discovery service that keeps connections in memory.

Configuration parameters

  • [connection key 1]:
    • ... connection parameters for key 1
  • [connection key 2]:
    • ... connection parameters for key N
see

IDiscovery

see

ConnectionParams

Example

let config = ConfigParams.fromTuples(
    "key1.host", "10.1.1.100",
    "key1.port", "8080",
    "key2.host", "10.1.1.100",
    "key2.port", "8082"
);

let discovery = new MemoryDiscovery();
discovery.readConnections(config);

discovery.resolve("123", "key1", (err, connection) => {
    // Result: host=10.1.1.100;port=8080
});

Hierarchy

  • MemoryDiscovery

Implements

Index

Constructors

constructor

Methods

configure

  • configure(config: ConfigParams): void
  • Configures component by passing configuration parameters.

    Parameters

    • config: ConfigParams

      configuration parameters to be set.

    Returns void

readConnections

  • readConnections(config: ConfigParams): void
  • Reads connections from configuration parameters. Each section represents an individual Connectionparams

    Parameters

    • config: ConfigParams

      configuration parameters to be read

    Returns void

register

  • register(correlationId: string, key: string, connection: ConnectionParams, callback: function): void
  • Registers connection parameters into the discovery service.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • key: string

      a key to uniquely identify the connection parameters.

    • connection: ConnectionParams
    • callback: function

      callback function that receives a registered connection or error.

        • (err: any, result: any): void
        • Parameters

          • err: any
          • result: any

          Returns void

    Returns void

resolveAll

  • resolveAll(correlationId: string, key: string, callback: function): void
  • Resolves all connection parameters by their key.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • key: string

      a key to uniquely identify the connections.

    • callback: function

      callback function that receives found connections or error.

    Returns void

resolveOne

  • resolveOne(correlationId: string, key: string, callback: function): void
  • Resolves a single connection parameters by its key.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • key: string

      a key to uniquely identify the connection.

    • callback: function

      callback function that receives found connection or error.

    Returns void

Generated using TypeDoc