in dubbo-registry-extensions/dubbo-registry-nameservice/src/main/java/org/apache/dubbo/registry/nameservice/NameServiceRegistry.java [184:213]
public void doSubscribe(URL url, NotifyListener listener) {
if (Objects.equals(url.getCategory(),
org.apache.dubbo.common.constants.RegistryConstants.CONFIGURATORS_CATEGORY)) {
return;
}
ServiceName serviceName = this.createServiceName(url);
try {
GroupList groupList = this.mqAdminExt.queryTopicConsumeByWho(serviceName.getValue());
if (Objects.isNull(groupList) || groupList.getGroupList().isEmpty()) {
return;
}
} catch (InterruptedException | MQBrokerException | RemotingException | MQClientException e) {
String exceptionInfo =
String.format("query topic consume fial, topic name is %s , url is %s , cause %s", serviceName.getValue(), url, e.getMessage());
logger.error(exceptionInfo, e);
throw new RuntimeException(exceptionInfo, e);
}
List<URL> urls = new ArrayList<URL>();
if (this.isNotRoute) {
URL providerURL = this.createProviderURL(serviceName, url, -1);
urls.add(providerURL);
} else {
RegistryInfoWrapper registryInfoWrapper = new RegistryInfoWrapper();
registryInfoWrapper.listener = listener;
registryInfoWrapper.serviceName = serviceName;
consumerRegistryInfoWrapperMap.put(url, registryInfoWrapper);
this.pullRoute(serviceName, url, urls);
}
listener.notify(urls);
}