Class AbstractDnsDiscoveryService<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>>

java.lang.Object
io.inverno.mod.discovery.AbstractDiscoveryService<A,B,C>
io.inverno.mod.discovery.AbstractDnsDiscoveryService<A,B,C>
Type Parameters:
A - the type of service instance
B - the type of service request
C - the type of traffic policy
All Implemented Interfaces:
DiscoveryService<A,B,C>

public abstract class AbstractDnsDiscoveryService<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>> extends AbstractDiscoveryService<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 Details

    • AbstractDnsDiscoveryService

      public AbstractDnsDiscoveryService(NetService netService, Set<String> supportedSchemes)

      Creates a DNS discovery service.

      Parameters:
      netService - the net service
      supportedSchemes - the set of supported schemes
  • Method Details

    • createUnresolvedAddress

      protected abstract InetSocketAddress createUnresolvedAddress(ServiceID serviceId)

      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 ID
      trafficPolicy - the traffic policy
      resolvedAddress - the resolved address
      Returns:
      a new service instance
    • doResolve

      protected final Mono<? extends Service<A,B,C>> doResolve(ServiceID serviceId, C trafficPolicy)
      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 class AbstractDiscoveryService<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>>
      Parameters:
      serviceId - a service ID
      trafficPolicy - a traffic policy
      Returns:
      a Mono emitting the resolved service or an empty Mono if no service could be resolved