Interface DiscoveryService<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>>

Type Parameters:
A - the type of service instance
B - the type of service request
C - the type of traffic policy
All Known Subinterfaces:
HttpDiscoveryService
All Known Implementing Classes:
AbstractConfigurationDiscoveryService, AbstractDiscoveryService, AbstractDnsDiscoveryService, CachingDiscoveryService, CompositeDiscoveryService

public interface DiscoveryService<A extends ServiceInstance,B,C extends TrafficPolicy<A,B>>

A discovery service is used to resolve Service from a ServiceID identifying a service and a TrafficPolicy conveying local service configuration.

The service ID is nothing more than an absolute URI providing the information required by a compatible discovery service to resolve a specific service. The scheme of the URI is used to determine whether a service can be resolved by a given discovery service. How the service URI is interpreted during service resolution is implementation specific.

Since:
1.12
Author:
Jeremy Kuhn
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the list of schemes supported by the discovery service.
    Mono<? extends Service<A,B,C>>
    resolve(ServiceID serviceId, C trafficPolicy)
    Resolves a service.
    default boolean
    supports(ServiceID serviceId)
    Determines whether the discovery service can resolve the specified service ID.
    default boolean
    supports(String scheme)
    Determines whether the discovery service supports the specified scheme.
    default boolean
    Determines whether the discovery service supports the specified service URI.
  • Method Details

    • supports

      default boolean supports(String scheme)

      Determines whether the discovery service supports the specified scheme.

      Parameters:
      scheme - a URI scheme
      Returns:
      true if the discovery service can resolve service URI with the specified scheme, false otherwise
    • supports

      default boolean supports(URI uri)

      Determines whether the discovery service supports the specified service URI.

      Parameters:
      uri - a service URI
      Returns:
      true if the discovery service can resolve the specified service URI, false otherwise
    • supports

      default boolean supports(ServiceID serviceId)

      Determines whether the discovery service can resolve the specified service ID.

      Parameters:
      serviceId - a service ID
      Returns:
      true if the discovery service can resolve the specified service ID, false otherwise
    • getSupportedSchemes

      Set<String> getSupportedSchemes()

      Returns the list of schemes supported by the discovery service.

      Returns:
      a set of lower cased schemes
    • resolve

      Mono<? extends Service<A,B,C>> resolve(ServiceID serviceId, C trafficPolicy) throws IllegalArgumentException

      Resolves a service.

      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
      Throws:
      IllegalArgumentException - if the specified service ID is not supported