HttpConnectionResolver class

Helper class to retrieve connections for HTTP-based services abd clients.

In addition to regular functions of ConnectionResolver is able to parse http:// URIs and validate connection parameters before returning them.

Configuration parameters

  • connection:

    • discovery_key: (optional) a key to retrieve the connection from IDiscovery
    • ... other connection parameters
  • connections: alternative to connection

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

References

  • *:discovery:*:*:1.0 (optional) IDiscovery services to resolve connections

See ConnectionParams See ConnectionResolver

Example

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

var connectionResolver = HttpConnectionResolver();
connectionResolver.configure(config);
connectionResolver.setReferences(references);

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

Constructors

HttpConnectionResolver()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

configure(ConfigParams config) → void
Configures component by passing configuration parameters.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register(IContext? context) Future<void>
Registers the given connection in all referenced discovery services. This method can be used for dynamic service discovery.
resolve(IContext? context) Future<ConfigParams>
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(IContext? context) Future<ConfigParams>
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.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited