Interface ServiceInstance

  • All Known Subinterfaces:
    EmbeddedServerInstance

    public interface ServiceInstance

    Represents a remote service discovered by the underlying discovery implementation.

    Since:
    1.0
    • Method Detail

      • getId

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

        java.net.URI getURI()
        Returns:
        The service URI
      • getInstanceId

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

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

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

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

        default io.micronaut.core.convert.value.ConvertibleValues<java.lang.String> getMetadata()
        Returns:
        The service metadata
      • getHost

        default java.lang.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 java.net.URI resolve​(java.net.URI relativeURI)
        Resolve a URI relative to this service instance.
        Parameters:
        relativeURI - The relative URI
        Returns:
        The relative URI
      • of

        static ServiceInstance of​(java.lang.String id,
                                  java.net.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​(java.lang.String id,
                                  java.net.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​(java.lang.String id,
                                  java.lang.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​(java.lang.String id,
                                               java.net.URI uri)
        A builder to builder a ServiceInstance.
        Parameters:
        id - The id
        uri - The URI
        Returns:
        The builder