ConnectionResolver class

Helper class to retrieve component connections.

If connections are configured to be retrieved from IDiscovery, it automatically locates IDiscovery in component references and retrieve connections from there using discovery_key parameter.

Configuration parameters

  • connection:

    • discovery_key: (optional) a key to retrieve the connection from https://rawgit.com/pip-services-node/pip-services-components-node/master/doc/api/interfaces/connect.idiscovery.html IDiscovery
    • ... other connection parameters
  • connections: alternative to connection

    • connection params 1: first connection parameters
      • ... connection parameters for key 1
    • connection params N: Nth connection parameters
      • ... connection parameters for key N

References

  • *:discovery:*:*:1.0 (optional) https://rawgit.com/pip-services-node/pip-services-components-node/master/doc/api/interfaces/connect.idiscovery.html IDiscovery services to resolve connections

See ConnectionParams See IDiscovery

Example

var config = ConfigParams.fromTuples(
    'connection.host', '10.1.1.100',
    'connection.port', 8080
);

var connectionResolver = new ConnectionResolver();
connectionResolver.configure(config);
connectionResolver.setReferences(references);

connection await = connectionResolver.resolve('123')
    // Now use connection...

Constructors

ConnectionResolver([ConfigParams config, IReferences references ])
Creates a new instance of connection resolver. [...]

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

add(ConnectionParams connection) → void
Adds a new connection to component connections [...]
configure(ConfigParams config) → void
Configures component by passing configuration parameters. [...]
getAll() → List<ConnectionParams>
Gets all connections configured in component configuration. [...]
register(String correlationId, ConnectionParams connection) → Future<ConnectionParams>
Registers the given connection in all referenced discovery services. This method can be used for dynamic service discovery. [...]
resolve(String correlationId) → Future<ConnectionParams>
Resolves a single component connection. If connections are configured to be retrieved from Discovery service it finds a IDiscovery and resolves the connection there. [...]
resolveAll(String correlationId) → Future<List<ConnectionParams>>
Resolves all component connection. If connections are configured to be retrieved from Discovery service it finds a IDiscovery and resolves the connection there. [...]
setReferences(IReferences references) → void
Sets references to dependent components. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited