Module io.inverno.mod.discovery.http
module io.inverno.mod.discovery.http
The Inverno framework HTTP service discovery module defines the API for HTTP service discovery and provides the DNS based HTTP discovery service.
It defines the following sockets:
- httpClient (required)
- the HTTP client used to create endpoints
- netService (required)
- the Net service used for DNS lookups
It exposes the following beans:
- dnsHttpDiscoveryService
- the DNS based HTTP discovery service
The DNS based HTTP discovery service is typically used to resolve standard http://
, https://
, ws://
or wss://
service URIs.
HttpClient httpClient = ...
NetService netService = ...
Http discoveryHttpModule = new Http.Builder(httpClient, netService).build();
try {
discoveryHttpModule.start();
httpClient.exchange("/")
.flatMap(exchange -> discoveryHttpModule.dnsHttpDiscoveryService().resolve(ServiceId.of("http://example.org")) // resolve the service
.flatMap(service -> service.getInstance(exchange)) // get an instance
.map(serviceInstance -> serviceInstance.bind(exchange)) // bind the exchange to the instance
)
.flatMap(Exchange::response) // send the request
...
}
finally {
discoveryHttpModule.stop();
}
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Packages
FromPackagesio.inverno.mod.base io.inverno.mod.base.concurrent io.inverno.mod.base.converter io.inverno.mod.base.net io.inverno.mod.base.reflect io.inverno.mod.base.resource -
Modules
ModifierModuleDescriptiontransitiveDefines the foundational APIs of the Inverno framework modules.transitiveThe Inverno framework discovery module defines the API used for service discovery.transitiveThe Inverno framework HTTP client module provides an HTTP1.x and HTTP/2 client.ModifierModuleDescriptiontransitiveThe Inverno framework HTTP base module defines base APIs and services for HTTP client and server implementations.