Interface MetadataService


public interface MetadataService
This service is used to expose the metadata information inside a Dubbo process. Typical uses include: 1. The Consumer queries the metadata information of the Provider to list the interfaces and each interface's configuration 2. The Console (dubbo-admin) queries for the metadata of a specific process, or aggregate data of all processes.
  • Field Details

  • Method Details

    • serviceName

      String serviceName()
      Gets the current Dubbo Service name
      Returns:
      non-null
    • version

      default String version()
      Gets the version of MetadataService that always equals VERSION
      Returns:
      non-null
      See Also:
    • getMetadataURL

      org.apache.dubbo.common.URL getMetadataURL()
    • getSubscribedURLs

      default SortedSet<String> getSubscribedURLs()
      the list of String that presents all Dubbo subscribed urls
      Returns:
      the non-null read-only sorted set of strings presenting the URLs
      See Also:
    • getExportedURLs

      default SortedSet<String> getExportedURLs()
      Get the sorted set of String that presents all Dubbo exported urls
      Returns:
      the non-null read-only sorted set of strings presenting the URLs
      See Also:
    • getExportedURLs

      default SortedSet<String> getExportedURLs(String serviceInterface)
      Get the sorted set of String that presents the specified Dubbo exported urls by the serviceInterface
      Parameters:
      serviceInterface - The class name of Dubbo service interface
      Returns:
      the non-null read-only sorted set of strings presenting the URLs
      See Also:
    • getExportedURLs

      default SortedSet<String> getExportedURLs(String serviceInterface, String group)
      Get the sorted set of String that presents the specified Dubbo exported urls by the serviceInterface and group
      Parameters:
      serviceInterface - The class name of Dubbo service interface
      group - the Dubbo Service Group (optional)
      Returns:
      the non-null read-only sorted set of strings presenting the URLs
      See Also:
    • getExportedURLs

      default SortedSet<String> getExportedURLs(String serviceInterface, String group, String version)
      Get the sorted set of String that presents the specified Dubbo exported urls by the serviceInterface, group and version
      Parameters:
      serviceInterface - The class name of Dubbo service interface
      group - the Dubbo Service Group (optional)
      version - the Dubbo Service Version (optional)
      Returns:
      the non-null read-only sorted set of strings presenting the URLs
      See Also:
    • getExportedURLs

      SortedSet<String> getExportedURLs(String serviceInterface, String group, String version, String protocol)
      Get the sorted set of String that presents the specified Dubbo exported urls by the serviceInterface, group, version and protocol
      Parameters:
      serviceInterface - The class name of Dubbo service interface
      group - the Dubbo Service Group (optional)
      version - the Dubbo Service Version (optional)
      protocol - the Dubbo Service Protocol (optional)
      Returns:
      the non-null read-only sorted set of strings presenting the URLs
      See Also:
    • getExportedServiceURLs

      default Set<org.apache.dubbo.common.URL> getExportedServiceURLs()
    • getServiceDefinition

      default String getServiceDefinition(String interfaceName, String version, String group)
      Interface definition.
      Returns:
    • getServiceDefinition

      String getServiceDefinition(String serviceKey)
    • getMetadataInfo

      MetadataInfo getMetadataInfo(String revision)
    • getMetadataInfos

      List<MetadataInfo> getMetadataInfos()
    • toSortedStrings

      static SortedSet<String> toSortedStrings(Iterable<org.apache.dubbo.common.URL> iterable)
      Convert the specified Iterable of URLs to be the strings presenting the URLs
      Parameters:
      iterable - Iterable of URL
      Returns:
      the non-null read-only sorted set of strings presenting
      See Also:
      • URL.toFullString()
    • toSortedStrings

      static SortedSet<String> toSortedStrings(Stream<org.apache.dubbo.common.URL> stream)
      Convert the specified Stream of URLs to be the strings presenting the URLs
      Parameters:
      stream - Stream of URL
      Returns:
      the non-null read-only sorted set of strings presenting
      See Also:
      • URL.toFullString()
    • isMetadataService

      static boolean isMetadataService(String interfaceName)
    • exportInstanceMetadata

      void exportInstanceMetadata(String instanceMetadata)
      Export Metadata in Service Instance of Service Discovery

      Used for consumer to get Service Instance Metadata if Registry is unsupported with publishing metadata

      Parameters:
      instanceMetadata - Map of provider Service Instance Metadata
      Since:
      3.0
    • getInstanceMetadataChangedListenerMap

      Map<String,InstanceMetadataChangedListener> getInstanceMetadataChangedListenerMap()
      Get all Metadata listener from local

      Used for consumer to get Service Instance Metadata if Registry is unsupported with publishing metadata

      Returns:
      Map of InstanceMetadataChangedListener
      Since:
      3.0
    • getAndListenInstanceMetadata

      String getAndListenInstanceMetadata(String consumerId, InstanceMetadataChangedListener listener)
      1. Fetch Metadata in Service Instance of Service Discovery 2. Add a metadata change listener

      Used for consumer to get Service Instance Metadata if Registry is unsupported with publishing metadata

      Parameters:
      consumerId - consumerId
      listener - InstanceMetadataChangedListener used to notify event
      Returns:
      Map of provider Service Instance Metadata
      Since:
      3.0