chickenlj commented on code in PR #14096:
URL: https://github.com/apache/dubbo/pull/14096#discussion_r1574051984
##########
dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java:
##########
@@ -697,14 +737,21 @@ private NacosServiceName createServiceName(URL url) {
return valueOf(url);
}
- private String getServiceName(URL url) {
+ private String getServiceName(URL url, boolean needCompatible) {
+ if (needCompatible) {
+ return getServiceName0(url, url.getCategory(DEFAULT_CATEGORY));
+ }
return getServiceName(url, url.getCategory(DEFAULT_CATEGORY));
}
private String getServiceName(URL url, String category) {
return category + SERVICE_NAME_SEPARATOR + url.getColonSeparatedKey();
}
+ private String getServiceName0(URL url, String category) {
Review Comment:
I think `getCompatibleServiceName` would be easier to understand than
`getServiceName0`. Please also use the `CompatibleXxx` naming pattern for other
methods.
##########
dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java:
##########
@@ -174,18 +182,33 @@ public List<URL> lookup(final URL url) {
public void doRegister(URL url) {
try {
if (PROVIDER_SIDE.equals(url.getSide()) ||
getUrl().getParameter(REGISTER_CONSUMER_URL_KEY, false)) {
- String serviceName = getServiceName(url);
Instance instance = createInstance(url);
+
+ Set<String> serviceNames = new HashSet<>();
+ // by default servicename is
"org.apache.dubbo.xxService:1.0.0:"
+ String serviceName = getServiceName(url, false);
+ serviceNames.add(serviceName);
+
+ // in https://github.com/apache/dubbo/issues/14075
+ if
(Boolean.parseBoolean(DUUBO_NACOS_EXPORT_NOTING_SUFFIX_SERVICENAME)) {
Review Comment:
Using `getUrl().getParameter("nacos.register-compatible", false)` would be
better. That way, users can configure in a more standard way supported by Dubbo
Config component:
```yaml
dubbo:
registry:
parameters:
nacos.register-compatible: true
```
or
```shell
-Ddubbo.registry.parameters.nacos.register-compatible=true
```
or
```properties
dubbo.registry.parameters.nacos.register-compatible=true
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]