pip_services3_rpc.connect.HttpConnectionResolver module
pip_services3_rpc.connect.HttpConnectionResolver
HttpConnectionResolver implementation
- copyright
Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
- license
MIT, see LICENSE for more details.
- class pip_services3_rpc.connect.HttpConnectionResolver.HttpConnectionResolver
Bases:
pip_services3_commons.refer.IReferenceable.IReferenceable
,pip_services3_commons.config.IConfigurable.IConfigurable
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 connection
Example:
config = ConfigParams.from_tuples("connection.host", "10.1.1.100","connection.port", 8080) connectionResolver = HttpConnectionResolver() connectionResolver.configure(config) connectionResolver.set_references(references) params = connectionResolver.resolve("123")
- configure(config: pip_services3_commons.config.ConfigParams.ConfigParams)
Configures component by passing configuration parameters. :param config: configuration parameters to be set.
- register(correlation_id: Optional[str])
Registers the given connection in all referenced discovery services. This method can be used for dynamic service discovery.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
- resolve(correlation_id: Optional[str]) pip_services3_commons.config.ConfigParams.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.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
- Returns
resolved connection.
- resolve_all(correlation_id: Optional[str]) pip_services3_commons.config.ConfigParams.ConfigParams
Resolves all component connection. If connections are configured to be retrieved from Discovery service it finds a IDiscovery and resolves the connection there.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
- Returns
resolved connections.
- set_references(references: pip_services3_commons.refer.IReferences.IReferences)
Sets references to dependent components.
- Parameters
references – references to locate the component dependencies.