The possible bug is as follows (as outlined under clause):
private List<URL> discovery(String protocol, String serviceId, String tag) {
if(logger.isDebugEnabled()) logger.debug("protocol = " + protocol + " serviceId = " + serviceId + " tag = " + tag);
URL subscribeUrl = URLImpl.valueOf(protocol + "://localhost/" + serviceId);
if(tag != null) {
subscribeUrl.addParameter(Constants.TAG_ENVIRONMENT, tag);
}
if(logger.isDebugEnabled()) logger.debug("subscribeUrl = " + subscribeUrl);
// subscribe is async and the result won't come back immediately.
registry.subscribe(subscribeUrl, null); // clause 1 -- passing null as a 2nd parameter
// do a lookup for the quick response from either cache or registry service.
List<URL> urls = registry.discover(subscribeUrl);
if(logger.isDebugEnabled()) logger.debug("discovered urls = " + urls);
return urls;
}
This will call AbstractRegistry.subscribe method:
@Override
public void subscribe(URL url, NotifyListener listener) { // clause 2 -- listener will be null here.
if (url == null) {
logger.warn("[{}] subscribe with malformed param, url:{}", registryClassName, url);
return;
}
if(logger.isInfoEnabled()) logger.info("[{}] Listener ({}) will subscribe to url ({}) in Registry [{}]",
registryClassName, listener, url, registryUrl.getIdentity());
doSubscribe(url.createCopy(), listener); // clause 3 -- will call this
}
This will call ConsulRegistry.doSubscribe method
@Override
protected void doSubscribe(URL url, final NotifyListener listener) {
// you only need to subscribe once.
if(!subscribedSet.contains(url)) {
addNotifyListener(url, listener); // clause 4 - will call this
startListenerThreadIfNewService(url);
subscribedSet.add(url);
}
}
This will call the ConsulRegistry.addNotifyListener method which is where the issue is:
Hi, I am getting the below error.
My service.yml is as follows:
The possible bug is as follows (as outlined under clause):
This will call AbstractRegistry.subscribe method:
This will call ConsulRegistry.doSubscribe method
This will call the ConsulRegistry.addNotifyListener method which is where the issue is:
This looks like a bug. Supposedly this method is invoked 1st time.
Can you help? Maybe it's something i missed but i just don't see any other thing other than a bug. This same code exists from version 2.0.21 - 2.1.37.