Interface ServiceNameMapping

All Superinterfaces:
org.apache.dubbo.rpc.service.Destroyable
All Known Implementing Classes:
AbstractServiceNameMapping

@SPI(value="metadata", scope=APPLICATION) public interface ServiceNameMapping extends org.apache.dubbo.rpc.service.Destroyable
This will interact with remote metadata center to find the interface-app mapping and will cache the data locally. Call variants of getCachedMapping() methods whenever need to use the mapping data.
  • Field Details

  • Method Details

    • map

      boolean map(org.apache.dubbo.common.URL url)
      Map the specified Dubbo service interface, group, version and protocol to current Dubbo service name
    • hasValidMetadataCenter

      boolean hasValidMetadataCenter()
    • getDefaultExtension

      static ServiceNameMapping getDefaultExtension(org.apache.dubbo.rpc.model.ScopeModel scopeModel)
      Get the default extension of ServiceNameMapping
      Returns:
      non-null ServiceNameMapping
    • buildMappingKey

      static String buildMappingKey(org.apache.dubbo.common.URL url)
    • buildGroup

      static String buildGroup(String serviceInterface)
    • toStringKeys

      static String toStringKeys(Set<String> serviceNames)
    • getAppNames

      static Set<String> getAppNames(String content)
    • getMappingByUrl

      static Set<String> getMappingByUrl(org.apache.dubbo.common.URL consumerURL)
    • getAndListen

      Set<String> getAndListen(org.apache.dubbo.common.URL registryURL, org.apache.dubbo.common.URL subscribedURL, MappingListener listener)
      Get the latest mapping result from remote center and register listener at the same time to get notified once mapping changes.
      Parameters:
      listener - listener that will be notified on mapping change
      Returns:
      the latest mapping result from remote center
    • stopListen

      MappingListener stopListen(org.apache.dubbo.common.URL subscribeURL, MappingListener listener)
    • putCachedMapping

      void putCachedMapping(String serviceKey, Set<String> apps)
    • getMapping

      Set<String> getMapping(org.apache.dubbo.common.URL consumerURL)
    • getRemoteMapping

      Set<String> getRemoteMapping(org.apache.dubbo.common.URL consumerURL)
    • removeCachedMapping

      Set<String> removeCachedMapping(String serviceKey)