use of org.apache.dubbo.registry.client.metadata.store.RemoteMetadataServiceImpl in project dubbo by alibaba.
the class ServiceInstanceMetadataUtils method refreshMetadataAndInstance.
public static void refreshMetadataAndInstance() {
RemoteMetadataServiceImpl remoteMetadataService = MetadataUtils.getRemoteMetadataService();
remoteMetadataService.publishMetadata(ApplicationModel.getName());
AbstractRegistryFactory.getServiceDiscoveries().forEach(serviceDiscovery -> {
calInstanceRevision(serviceDiscovery, serviceDiscovery.getLocalInstance());
// update service instance revision
serviceDiscovery.update(serviceDiscovery.getLocalInstance());
});
}
use of org.apache.dubbo.registry.client.metadata.store.RemoteMetadataServiceImpl in project dubbo by alibaba.
the class DubboBootstrap method publishMetadataToRemote.
private void publishMetadataToRemote(ServiceInstance serviceInstance) {
// InMemoryWritableMetadataService localMetadataService = (InMemoryWritableMetadataService)WritableMetadataService.getDefaultExtension();
// localMetadataService.blockUntilUpdated();
RemoteMetadataServiceImpl remoteMetadataService = MetadataUtils.getRemoteMetadataService();
remoteMetadataService.publishMetadata(serviceInstance.getServiceName());
}
use of org.apache.dubbo.registry.client.metadata.store.RemoteMetadataServiceImpl in project dubbo by alibaba.
the class ServiceInstancesChangedListener method getMetadataInfo.
private MetadataInfo getMetadataInfo(ServiceInstance instance) {
String metadataType = ServiceInstanceMetadataUtils.getMetadataStorageType(instance);
// FIXME, check "REGISTRY_CLUSTER_KEY" must be set by every registry implementation.
instance.getExtendParams().putIfAbsent(REGISTRY_CLUSTER_KEY, RegistryClusterIdentifier.getExtension(url).consumerKey(url));
MetadataInfo metadataInfo = null;
try {
if (logger.isDebugEnabled()) {
logger.debug("Instance " + instance.getAddress() + " is using metadata type " + metadataType);
}
if (REMOTE_METADATA_STORAGE_TYPE.equals(metadataType)) {
RemoteMetadataServiceImpl remoteMetadataService = MetadataUtils.getRemoteMetadataService();
metadataInfo = remoteMetadataService.getMetadata(instance);
} else {
MetadataService metadataServiceProxy = MetadataUtils.getMetadataServiceProxy(instance, serviceDiscovery);
metadataInfo = metadataServiceProxy.getMetadataInfo(ServiceInstanceMetadataUtils.getExportedServicesRevision(instance));
}
if (logger.isDebugEnabled()) {
logger.debug("Metadata " + metadataInfo.toString());
}
} catch (Exception e) {
logger.error("Failed to load service metadata, metadata type is " + metadataType, e);
// TODO, load metadata backup. Stop getting metadata after x times of failure for one revision?
}
return metadataInfo;
}
Aggregations