This is an automated email from the ASF dual-hosted git repository.
zrlw pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.3 by this push:
new dc296d5ece fix(nacos): Add application key to consumer subscribe URL
(#15872)
dc296d5ece is described below
commit dc296d5ece93ff8b1da2c7ccdbd71169a11ebc5b
Author: ShauryaChauhan1411 <[email protected]>
AuthorDate: Wed Dec 17 08:10:18 2025 +0530
fix(nacos): Add application key to consumer subscribe URL (#15872)
* fix(nacos): Add application key to consumer subscribe URL
Fixes #15843
The subscriber URL constructed in NacosRegistry for the non-compatible mode
was missing the application key, causing the application name to default to
"unknown" in the Nacos client metadata. This commit adds the
CommonConstants.APPLICATION_KEY parameter using the consumer URL's application
name.
* style: remove unnecessary comment in NacosRegistry
---------
Co-authored-by: heliang <[email protected]>
---
.../main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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 fbeb9cf987..3c98e1c3e3 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
@@ -290,7 +290,13 @@ public class NacosRegistry extends FailbackRegistry {
serviceInterface = segments[SERVICE_INTERFACE_INDEX];
}
URL subscriberURL = url.setPath(serviceInterface)
- .addParameters(INTERFACE_KEY, serviceInterface,
CHECK_KEY, String.valueOf(false));
+ .addParameters(
+ INTERFACE_KEY,
+ serviceInterface,
+ CommonConstants.APPLICATION_KEY,
+ url.getApplication(),
+ CHECK_KEY,
+ String.valueOf(false));
notifySubscriber(subscriberURL, serviceName, listener,
instances);
subscribeEventListener(serviceName, subscriberURL,
listener);
}