Package org.apache.dubbo.metadata
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildGroup(String serviceInterface) static StringbuildMappingKey(org.apache.dubbo.common.URL url) 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.getAppNames(String content) static ServiceNameMappinggetDefaultExtension(org.apache.dubbo.rpc.model.ScopeModel scopeModel) Get the default extension ofServiceNameMappinggetMapping(org.apache.dubbo.common.URL consumerURL) getMappingByUrl(org.apache.dubbo.common.URL consumerURL) getRemoteMapping(org.apache.dubbo.common.URL consumerURL) booleanbooleanmap(org.apache.dubbo.common.URL url) Map the specified Dubbo service interface, group, version and protocol to current Dubbo service namevoidputCachedMapping(String serviceKey, Set<String> apps) removeCachedMapping(String serviceKey) stopListen(org.apache.dubbo.common.URL subscribeURL, MappingListener listener) static StringtoStringKeys(Set<String> serviceNames) Methods inherited from interface org.apache.dubbo.rpc.service.Destroyable
$destroy
-
Field Details
-
DEFAULT_MAPPING_GROUP
- See Also:
-
-
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
Get the default extension ofServiceNameMapping- Returns:
- non-null
ServiceNameMapping
-
buildMappingKey
-
buildGroup
-
toStringKeys
-
getAppNames
-
getMappingByUrl
-
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
-
putCachedMapping
-
getMapping
-
getRemoteMapping
-
removeCachedMapping
-