Interface ServiceInstance

All Superinterfaces:
Serializable
All Known Implementing Classes:
DefaultServiceInstance

public interface ServiceInstance extends Serializable
The model class of an instance of a service, which is used for service registration and discovery.

Since:
2.7.5
  • Method Details

    • getServiceName

      String getServiceName()
      The name of service that current instance belongs to.
      Returns:
      non-null
    • getHost

      String getHost()
      The hostname of the registered service instance.
      Returns:
      non-null
    • getPort

      int getPort()
      The port of the registered service instance.
      Returns:
      the positive integer if present
    • getAddress

      String getAddress()
    • isEnabled

      default boolean isEnabled()
      The enabled status of the registered service instance.
      Returns:
      if true, indicates current instance is enabled, or disable, the client should remove this one. The default value is true
    • isHealthy

      default boolean isHealthy()
      The registered service instance is health or not.
      Returns:
      if true, indicates current instance is healthy, or unhealthy, the client may ignore this one. The default value is true
    • getMetadata

      Map<String,String> getMetadata()
      The key / value pair metadata associated with the service instance.
      Returns:
      non-null, mutable and unsorted Map
    • getSortedMetadata

      SortedMap<String,String> getSortedMetadata()
    • getRegistryCluster

      String getRegistryCluster()
    • setRegistryCluster

      void setRegistryCluster(String registryCluster)
    • getExtendParams

      Map<String,String> getExtendParams()
    • getExtendParam

      String getExtendParam(String key)
    • putExtendParam

      String putExtendParam(String key, String value)
    • putExtendParamIfAbsent

      String putExtendParamIfAbsent(String key, String value)
    • removeExtendParam

      String removeExtendParam(String key)
    • getAllParams

      Map<String,String> getAllParams()
    • setApplicationModel

      void setApplicationModel(ApplicationModel applicationModel)
    • getApplicationModel

      ApplicationModel getApplicationModel()
    • getOrDefaultApplicationModel

      default ApplicationModel getOrDefaultApplicationModel()
    • getMetadata

      default String getMetadata(String name)
      Get the value of metadata by the specified name
      Parameters:
      name - the specified name
      Returns:
      the value of metadata if found, or null
      Since:
      2.7.8
    • getMetadata

      default String getMetadata(String name, String defaultValue)
      Get the value of metadata by the specified name
      Parameters:
      name - the specified name
      Returns:
      the value of metadata if found, or defaultValue
      Since:
      2.7.8
    • getServiceMetadata

      MetadataInfo getServiceMetadata()
    • setServiceMetadata

      void setServiceMetadata(MetadataInfo serviceMetadata)
    • toURL

      InstanceAddressURL toURL(String protocol)