Interface ServiceInstance

All Known Subinterfaces:
EmbeddedServerInstance

public interface ServiceInstance

Represents a remote service discovered by the underlying discovery implementation.

Since:
1.0
Author:
Graeme Rocher
  • Field Details

  • Method Details

    • getId

      String getId()
      Returns:
      The identifier of the service used for purposes of service discovery
    • getURI

      URI getURI()
      Returns:
      The service URI
    • getHealthStatus

      default HealthStatus getHealthStatus()
      Returns:
      The HealthStatus of the instance
    • getInstanceId

      default Optional<String> getInstanceId()
      Returns:
      The ID of the instance
    • getZone

      default Optional<String> getZone()
      Returns the availability zone to use. A zone is, for example, the AWS availability zone.
      Returns:
      The zone to use
    • getRegion

      default Optional<String> getRegion()
      Returns the region to use. A region is, for example, the AWS region
      Returns:
      The region
    • getGroup

      default Optional<String> getGroup()
      Returns the application group. For example, the AWS auto-scaling group.
      Returns:
      The group to use
    • getMetadata

      default ConvertibleValues<String> getMetadata()
      Returns:
      The service metadata
    • getHost

      default String getHost()
      Returns:
      The service host
    • isSecure

      default boolean isSecure()
      Returns:
      Is the service instance available over a secure connection
    • getPort

      default int getPort()
      Returns:
      The service port
    • resolve

      default URI resolve(URI relativeURI)
      Resolve a URI relative to this service instance.
      Parameters:
      relativeURI - The relative URI
      Returns:
      The relative URI
    • of

      static ServiceInstance of(String id, URL url)
      Construct a new ServiceInstance for the given ID and URL.
      Parameters:
      id - The ID
      url - The URL
      Returns:
      The instance
    • of

      static ServiceInstance of(String id, URI uri)
      Construct a new ServiceInstance for the given ID and URL.
      Parameters:
      id - The ID
      uri - The URI
      Returns:
      The instance
    • of

      static ServiceInstance of(String id, String host, int port)
      Construct a new ServiceInstance for the given ID, host and port using the HTTP scheme.
      Parameters:
      id - The ID
      host - The host
      port - The port
      Returns:
      The instance
    • builder

      static ServiceInstance.Builder builder(String id, URI uri)
      A builder to builder a ServiceInstance.
      Parameters:
      id - The id
      uri - The URI
      Returns:
      The builder