use of org.apache.dubbo.metadata.definition.model.FullServiceDefinition in project dubbo by alibaba.
the class RemoteMetadataServiceImpl method publishProvider.
private void publishProvider(URL providerUrl) throws RpcException {
// first add into the list
// remove the individual param
providerUrl = providerUrl.removeParameters(PID_KEY, TIMESTAMP_KEY, Constants.BIND_IP_KEY, Constants.BIND_PORT_KEY, TIMESTAMP_KEY);
try {
String interfaceName = providerUrl.getParameter(INTERFACE_KEY);
if (StringUtils.isNotEmpty(interfaceName)) {
Class interfaceClass = Class.forName(interfaceName);
FullServiceDefinition fullServiceDefinition = ServiceDefinitionBuilder.buildFullDefinition(interfaceClass, providerUrl.getParameters());
for (Map.Entry<String, MetadataReport> entry : getMetadataReports().entrySet()) {
MetadataReport metadataReport = entry.getValue();
metadataReport.storeProviderMetadata(new MetadataIdentifier(providerUrl.getServiceInterface(), providerUrl.getParameter(VERSION_KEY), providerUrl.getParameter(GROUP_KEY), PROVIDER_SIDE, providerUrl.getParameter(APPLICATION_KEY)), fullServiceDefinition);
}
return;
}
logger.error("publishProvider interfaceName is empty . providerUrl: " + providerUrl.toFullString());
} catch (ClassNotFoundException e) {
// ignore error
logger.error("publishProvider getServiceDescriptor error. providerUrl: " + providerUrl.toFullString(), e);
}
}
use of org.apache.dubbo.metadata.definition.model.FullServiceDefinition in project dubbo by alibaba.
the class ServiceDefinitionBuilder method buildFullDefinition.
public static FullServiceDefinition buildFullDefinition(final Class<?> interfaceClass, Map<String, String> params) {
FullServiceDefinition sd = new FullServiceDefinition();
build(sd, interfaceClass);
sd.setParameters(params);
return sd;
}
use of org.apache.dubbo.metadata.definition.model.FullServiceDefinition in project dubbo by alibaba.
the class ServiceDefinitionBuilder method buildFullDefinition.
public static FullServiceDefinition buildFullDefinition(final Class<?> interfaceClass) {
FullServiceDefinition sd = new FullServiceDefinition();
build(sd, interfaceClass);
return sd;
}
use of org.apache.dubbo.metadata.definition.model.FullServiceDefinition in project dubbo by alibaba.
the class EtcdMetadataReportTest method storeProvider.
private MetadataIdentifier storeProvider(EtcdMetadataReport etcdMetadataReport, String interfaceName, String version, String group, String application) throws ClassNotFoundException, InterruptedException {
URL url = URL.valueOf("xxx://" + NetUtils.getLocalAddress().getHostName() + ":4444/" + interfaceName + "?paramTest=etcdTest&version=" + version + "&application=" + application + (group == null ? "" : "&group=" + group));
MetadataIdentifier providerMetadataIdentifier = new MetadataIdentifier(interfaceName, version, group, PROVIDER_SIDE, application);
Class interfaceClass = Class.forName(interfaceName);
FullServiceDefinition fullServiceDefinition = ServiceDefinitionBuilder.buildFullDefinition(interfaceClass, url.getParameters());
etcdMetadataReport.storeProviderMetadata(providerMetadataIdentifier, fullServiceDefinition);
Thread.sleep(1000);
return providerMetadataIdentifier;
}
use of org.apache.dubbo.metadata.definition.model.FullServiceDefinition in project dubbo by alibaba.
the class RedisMetadataReportTest method storePrivider.
private MetadataIdentifier storePrivider(RedisMetadataReport redisMetadataReport, String interfaceName, String version, String group, String application) throws ClassNotFoundException {
URL url = URL.valueOf("xxx://" + NetUtils.getLocalAddress().getHostName() + ":4444/" + interfaceName + "?paramTest=redisTest&version=" + version + "&application=" + application + (group == null ? "" : "&group=" + group));
MetadataIdentifier providerMetadataIdentifier = new MetadataIdentifier(interfaceName, version, group, PROVIDER_SIDE, application);
Class interfaceClass = Class.forName(interfaceName);
FullServiceDefinition fullServiceDefinition = ServiceDefinitionBuilder.buildFullDefinition(interfaceClass, url.getParameters());
redisMetadataReport.storeProviderMetadata(providerMetadataIdentifier, fullServiceDefinition);
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
return providerMetadataIdentifier;
}
Aggregations