1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

bugfix invokers metadata tag error

This commit is contained in:
chris 2021-04-14 09:59:49 +08:00
parent 139b03e652
commit 3ad550f211

View File

@ -308,6 +308,16 @@ public class DubboCloudRegistry extends FailbackRegistry {
String protocol = templateURL.getProtocol();
Integer port = repository.getDubboProtocolPort(serviceInstance,
protocol);
// reserve tag
String tag = null;
List<URL> urls = jsonUtils.toURLs(serviceInstance.getMetadata()
.get("dubbo.metadata-service.urls"));
if (urls != null && urls.size() > 0) {
Map<String, String> parameters = urls.get(0).getParameters();
tag = parameters.get("dubbo.tag");
}
if (Objects.equals(templateURL.getHost(), host)
&& Objects.equals(templateURL.getPort(), port)) { // use
// templateURL
@ -331,7 +341,8 @@ public class DubboCloudRegistry extends FailbackRegistry {
// the template
// URL
.setHost(host) // reset the host
.setPort(port); // reset the port
.setPort(port) // reset the port
.addParameter("dubbo.tag", tag); // reset the tag
return clonedURLBuilder.build();
}