Module io.inverno.mod.discovery.http.meta
The Inverno framework HTTP meta service discovery module defines the meta HTTP service API and provides a configuration based HTTP meta service discovery service.
An HTTP meta service composes multiple HTTP services defined as destinations in one or more routes defining the criteria (path, authority, headers...) matched by a given HTTP request to be routed to a particular set of destinations as well as load balancing strategy, request/response transformation, HTTP client configuration...
The module defines the following sockets:
- serviceConfigurationSource (required)
- a configuration source exposing HTTP meta service descriptors
- configuration
- the HTTP discovery meta module configuration
- discoveryServices
- the external discovery services used to resolve HTTP meta service destinations
- objectMapper
- an object mapper to read JSON HTTP meta service descriptors
It exposes the following beans:
- configuration
- the HTTP discovery meta module configuration
- configurationHttpMetaDiscoveryService
- the configuration HTTP meta service discovery service
The configuration HTTP meta service discovery service resolves services from service descriptors defined in a configuration source, a configuration HTTP meta service URI being of the form
conf://<service_name>
.
ConfigurationSource serviceConfigurationSource = ...
HttpDiscoveryService dnsHttpDiscoveryService = ...
Meta discoveryHttpMetaModule = new Meta.Builder(serviceConfigurationSource)
.setDiscoveryServices(List.of(dnsHttpDiscoveryService))
.build();
try {
discoveryHttpMetaModule.start();
httpClient.exchange("/")
.flatMap(exchange -> discoveryHttpMetaModule.configurationHttpMetaDiscoveryService().resolve(ServiceId.of("conf://sampleService")) // resolve the meta 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 {
discoveryHttpMetaModule.stop();
}
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Packages
PackageDescriptionInverno HTTP Meta Discovery Service API and module configuration.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 service discovery module defines the API for HTTP service discovery and provides the DNS based HTTP discovery service.ModifierModuleDescriptiontransitiveThe Inverno framework HTTP base module defines base APIs and services for HTTP client and server implementations.transitiveThe Inverno framework HTTP client module provides an HTTP1.x and HTTP/2 client.