Router Discovery¶
The Server-Side Service discovery strategy.
- class blacksmith.sd._async.adapters.router.AsyncRouterDiscovery(service_url_fmt: str = 'http://router/{service}-{version}/{version}', unversioned_service_url_fmt: str = 'http://router/{service}')¶
Router that implement a Server-Side Service discovery.
This implementation never raise
blacksmith.domain.exceptions.UnregisteredServiceException
when service are unknown, because it only passe very request to the router server that is connected to the service registry.Note
Given pattern in parameter have to match the format of the router server.
- Parameters:
service_url_fmt – A pattern used to create endpoint of versionned services.
unversioned_service_url_fmt – A pattern used to create endpoint of unversionned services.
- service_url_fmt: str¶
- unversioned_service_url_fmt: str¶
- async get_endpoint(service: str, version: str | None) str ¶
Create and return the endpoint using the given parameters service_url_fmt or unversioned_service_url_fmt if version is None.