fix: 解决多注册中心场景下,优雅上下线处理器相互覆盖的问题 (#1263)

pull/1272/head
andrew shan 1 year ago committed by GitHub
parent e5f06904b2
commit 1ee3975010
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -6,3 +6,4 @@
- [feat: support lane router](https://github.com/Tencent/spring-cloud-tencent/pull/1256)
- [feat: add lane router examples](https://github.com/Tencent/spring-cloud-tencent/pull/1260)
- [feat:upgrade jackson version.](https://github.com/Tencent/spring-cloud-tencent/pull/1262)
- [fix: fix the lossless provider override in multiple registries scenario](https://github.com/Tencent/spring-cloud-tencent/pull/1263)

@ -28,6 +28,11 @@ import org.springframework.cloud.client.serviceregistry.Registration;
public class NacosRegistrationTransformer implements RegistrationTransformer {
@Override
public String getRegistry() {
return "nacos";
}
@Override
public void transformCustom(DefaultInstance instance, Registration registration) {
if (registration instanceof NacosRegistration nacosRegistration) {

@ -20,6 +20,8 @@ package com.tencent.cloud.rpc.enhancement.transformer;
public class PolarisRegistrationTransformer implements RegistrationTransformer {
@Override
public String getRegistry() {
return "polaris";
}
}

@ -32,6 +32,8 @@ import org.springframework.cloud.client.serviceregistry.Registration;
*/
public interface RegistrationTransformer {
String getRegistry();
default Instance transform(Registration registration) {
DefaultInstance instance = new DefaultInstance();
transformDefault(instance, registration);
@ -40,6 +42,7 @@ public interface RegistrationTransformer {
}
default void transformDefault(DefaultInstance instance, Registration registration) {
instance.setRegistry(getRegistry());
instance.setNamespace(MetadataContext.LOCAL_NAMESPACE);
instance.setService(registration.getServiceId());
instance.setProtocol(registration.getScheme());

Loading…
Cancel
Save