Package io.inverno.mod.discovery.http
Interface HttpDiscoveryService
- All Superinterfaces:
DiscoveryService<HttpServiceInstance,
UnboundExchange<?>, HttpTrafficPolicy>
public interface HttpDiscoveryService
extends DiscoveryService<HttpServiceInstance,UnboundExchange<?>,HttpTrafficPolicy>
A discovery service for resolving HTTP services providing HttpServiceInstance
in order to process HTTP requests.
It is typically used as follows, to resolve an HTTP service and process HTTP requests on one or more HTTP service instances.
HttpClient httpClient = ...
HttpDiscoveryService httpDiscoveryService = ...
client.exchange("/path/to/resource")
.flatMap(exchange -> httpDiscoveryService.resolve(ServiceId.of("http://example.org"))
.flatMap(service -> service.getInstance(exchange))
.map(serviceInstance -> serviceInstance.bind(exchange))
)
.flatMap(Exchange::response)
...
- Since:
- 1.12
- Author:
- Jeremy Kuhn
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault Mono
<? extends Service<HttpServiceInstance, UnboundExchange<?>, HttpTrafficPolicy>> Resolves an HTTP service using a default HTTP traffic policy.Methods inherited from interface io.inverno.mod.discovery.DiscoveryService
getSupportedSchemes, resolve, supports, supports, supports
-
Method Details
-
resolve
default Mono<? extends Service<HttpServiceInstance,UnboundExchange<?>, resolveHttpTrafficPolicy>> (ServiceID serviceId) throws IllegalArgumentException Resolves an HTTP service using a default HTTP traffic policy.
- Parameters:
serviceId
- a service ID- Returns:
- a
Mono
emitting the resolved service or an emptyMono
if no service could be resolved - Throws:
IllegalArgumentException
- if the specified service ID is not supported
-