Class ServiceInstanceMetadataUtils

java.lang.Object
org.apache.dubbo.registry.client.metadata.ServiceInstanceMetadataUtils

public class ServiceInstanceMetadataUtils extends Object
The Utilities class for the metadata of the service instance
Since:
2.7.5
See Also:
  • Field Details

    • METADATA_SERVICE_PREFIX

      public static final String METADATA_SERVICE_PREFIX
      The prefix of MetadataService : "dubbo.metadata-service."
      See Also:
    • ENDPOINTS

      public static final String ENDPOINTS
      See Also:
    • METADATA_SERVICE_URL_PARAMS_PROPERTY_NAME

      public static final String METADATA_SERVICE_URL_PARAMS_PROPERTY_NAME
      The property name of metadata JSON of MetadataService's URL
      See Also:
    • METADATA_SERVICE_URLS_PROPERTY_NAME

      public static final String METADATA_SERVICE_URLS_PROPERTY_NAME
      The URLs property name of MetadataService : "dubbo.metadata-service.urls", which is used to be compatible with Dubbo Spring Cloud and discovery the metadata of instance
      See Also:
    • EXPORTED_SERVICES_REVISION_PROPERTY_NAME

      public static final String EXPORTED_SERVICES_REVISION_PROPERTY_NAME
      The property name of The revision for all exported Dubbo services.
      See Also:
    • METADATA_STORAGE_TYPE_PROPERTY_NAME

      public static final String METADATA_STORAGE_TYPE_PROPERTY_NAME
      The property name of metadata storage type.
      See Also:
    • METADATA_SERVICE_VERSION_NAME

      public static final String METADATA_SERVICE_VERSION_NAME
      See Also:
    • METADATA_CLUSTER_PROPERTY_NAME

      public static final String METADATA_CLUSTER_PROPERTY_NAME
      See Also:
  • Constructor Details

    • ServiceInstanceMetadataUtils

      public ServiceInstanceMetadataUtils()
  • Method Details

    • getMetadataServiceParameter

      public static String getMetadataServiceParameter(URL url)
    • getExportedServicesRevision

      public static String getExportedServicesRevision(ServiceInstance serviceInstance)
      The revision for all exported Dubbo services from the specified ServiceInstance.
      Parameters:
      serviceInstance - the specified ServiceInstance
      Returns:
      null if not exits
    • getMetadataStorageType

      public static String getMetadataStorageType(URL registryURL)
      Get metadata's storage type
      Parameters:
      registryURL - the URL to connect the registry
      Returns:
      if not found in parameters of registry URL, return
    • getMetadataStorageType

      public static String getMetadataStorageType(ServiceInstance serviceInstance)
      Get the metadata storage type specified by the peer instance.
      Returns:
      storage type, remote or local
    • setMetadataStorageType

      public static void setMetadataStorageType(ServiceInstance serviceInstance, String metadataType)
      Set the metadata storage type in specified service instance
      Parameters:
      serviceInstance - service instance
      metadataType - remote or local
    • getRemoteCluster

      public static String getRemoteCluster(ServiceInstance serviceInstance)
    • hasEndpoints

      public static boolean hasEndpoints(ServiceInstance serviceInstance)
    • setEndpoints

      public static void setEndpoints(ServiceInstance serviceInstance, Map<String,Integer> protocolPorts)
    • getEndpoint

      public static DefaultServiceInstance.Endpoint getEndpoint(ServiceInstance serviceInstance, String protocol)
      Get the property value of port by the specified the metadata of service instance and protocol
      Parameters:
      serviceInstance - service instance
      protocol - the name of protocol, e.g, dubbo, rest, and so on
      Returns:
      if not found, return null
    • registerMetadataAndInstance

      public static void registerMetadataAndInstance(ApplicationModel applicationModel)
    • refreshMetadataAndInstance

      public static void refreshMetadataAndInstance(ApplicationModel applicationModel)
    • unregisterMetadataAndInstance

      public static void unregisterMetadataAndInstance(ApplicationModel applicationModel)
    • customizeInstance

      public static void customizeInstance(ServiceInstance instance, ApplicationModel applicationModel)
    • isValidInstance

      public static boolean isValidInstance(ServiceInstance instance)