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

Co-authored-by: Haotian Zhang <skyebefreeman@qq.com>
Co-authored-by: andrew shan <45474304+andrewshan@users.noreply.github.com>
pull/1381/head
Fishtail 4 months ago committed by GitHub
parent 68ca394445
commit 36a71ac862
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -8,3 +8,4 @@
- [feat: support lossless online and offline](https://github.com/Tencent/spring-cloud-tencent/pull/1377)
- [feat: support lane router](https://github.com/Tencent/spring-cloud-tencent/pull/1378)
- [feat: add lane router examples](https://github.com/Tencent/spring-cloud-tencent/pull/1379)
- [fix: fix the lossless provider override in multiple registries scenario](https://github.com/Tencent/spring-cloud-tencent/pull/1380)

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

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