fix: fix the lossless provider override in multiple registries scenario (#1271)

Co-authored-by: andrew shan <45474304+andrewshan@users.noreply.github.com>
pull/1273/head
Haotian Zhang 7 months ago committed by GitHub
parent dd79384826
commit ba462408e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -7,3 +7,4 @@
- [feat: support lossless online and offline](https://github.com/Tencent/spring-cloud-tencent/pull/1268)
- [feat: support lane router](https://github.com/Tencent/spring-cloud-tencent/pull/1269)
- [feat: add lane router examples](https://github.com/Tencent/spring-cloud-tencent/pull/1270)
- [fix: fix the lossless provider override in multiple registries scenario](https://github.com/Tencent/spring-cloud-tencent/pull/1271)

@ -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