You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by cr...@apache.org on 2021/09/18 02:56:57 UTC
[dubbo] branch 3.0 updated: fix nacos admin protocol cant't get
interface name (#8782)
This is an automated email from the ASF dual-hosted git repository.
crazyhzm pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new 082e632 fix nacos admin protocol cant't get interface name (#8782)
082e632 is described below
commit 082e632f512632074e6cab26f80089e8e8b03d01
Author: haoyann <10...@qq.com>
AuthorDate: Sat Sep 18 10:56:32 2021 +0800
fix nacos admin protocol cant't get interface name (#8782)
---
.../org/apache/dubbo/registry/nacos/NacosRegistry.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java
index fda7841..b12e66d 100644
--- a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java
+++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java
@@ -55,6 +55,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static org.apache.dubbo.common.constants.CommonConstants.ANY_VALUE;
+import static org.apache.dubbo.common.constants.CommonConstants.CHECK_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.PATH_KEY;
@@ -227,12 +228,19 @@ public class NacosRegistry extends FailbackRegistry {
subscribeEventListener(serviceName, url, listener);
}
} else {
- List<Instance> instances = new LinkedList<>();
for (String serviceName : serviceNames) {
+ List<Instance> instances = new LinkedList<>();
instances.addAll(namingService.getAllInstances(serviceName
, getUrl().getGroup(Constants.DEFAULT_GROUP)));
- notifySubscriber(url, listener, instances);
- subscribeEventListener(serviceName, url, listener);
+ String serviceInterface = serviceName;
+ String[] segments = serviceName.split(SERVICE_NAME_SEPARATOR, -1);
+ if (segments.length == 4) {
+ serviceInterface = segments[SERVICE_INTERFACE_INDEX];
+ }
+ URL subscriberURL = url.setPath(serviceInterface).addParameters(INTERFACE_KEY, serviceInterface,
+ CHECK_KEY, String.valueOf(false));
+ notifySubscriber(subscriberURL, listener, instances);
+ subscribeEventListener(serviceName, subscriberURL, listener);
}
}
}catch (Throwable cause){