Class AbstractDnsDiscoveryService<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>>
- Type Parameters:
A
- the type of service instanceB
- the type of service requestC
- the type of traffic policy
- All Implemented Interfaces:
DiscoveryService<A,
B, C>
Base DNS based discovery service.
NetService.resolveAll(InetSocketAddress)
is used to resolve services identified by an unresolved Inet Socket Address obtained from the service ID with
createUnresolvedAddress(ServiceID)
. The DNS lookup might return one or more resolved Inet Socket Addresses from which service instances are created with
createServiceInstance(ServiceID, TrafficPolicy, InetSocketAddress)
.
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Constructor Summary
ConstructorDescriptionAbstractDnsDiscoveryService
(NetService netService, Set<String> supportedSchemes) Creates a DNS discovery service. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract A
createServiceInstance
(ServiceID serviceId, C trafficPolicy, InetSocketAddress resolvedAddress) Creates a service instance from the specified resolved Inet Socket Address.protected abstract InetSocketAddress
createUnresolvedAddress
(ServiceID serviceId) Returns the unresolved Inet Socket Address deduced from the specified service ID.Resolves a service.Methods inherited from class io.inverno.mod.discovery.AbstractDiscoveryService
getSupportedSchemes, resolve
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.inverno.mod.discovery.DiscoveryService
supports, supports, supports
-
Constructor Details
-
AbstractDnsDiscoveryService
Creates a DNS discovery service.
- Parameters:
netService
- the net servicesupportedSchemes
- the set of supported schemes
-
-
Method Details
-
createUnresolvedAddress
Returns the unresolved Inet Socket Address deduced from the specified service ID.
- Parameters:
serviceId
- a service ID- Returns:
- an unresolved Inet Socket Address
-
createServiceInstance
protected abstract A createServiceInstance(ServiceID serviceId, C trafficPolicy, InetSocketAddress resolvedAddress) Creates a service instance from the specified resolved Inet Socket Address.
- Parameters:
serviceId
- the service IDtrafficPolicy
- the traffic policyresolvedAddress
- the resolved address- Returns:
- a new service instance
-
doResolve
Description copied from class:AbstractDiscoveryService
Resolves a service.
This is basically invoked by
AbstractDiscoveryService.resolve(ServiceID, TrafficPolicy)
after validating that the service ID scheme is supported.- Specified by:
doResolve
in classAbstractDiscoveryService<A extends ServiceInstance,
B, C extends TrafficPolicy<A, B>> - Parameters:
serviceId
- a service IDtrafficPolicy
- a traffic policy- Returns:
- a
Mono
emitting the resolved service or an emptyMono
if no service could be resolved
-