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

pull/1342/head
Fishtail 1 year ago committed by GitHub
parent b6e0e0e11d
commit 950ebaaaa1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -7,4 +7,5 @@
- [fix: fix RouterLabelRestTemplateInterceptor add response headers exception with httpclient5.](https://github.com/Tencent/spring-cloud-tencent/pull/1337)
- [feat: support lossless online/offline](https://github.com/Tencent/spring-cloud-tencent/pull/1338)
- [feat: support lane router](https://github.com/Tencent/spring-cloud-tencent/pull/1339)
- [feat: add lane router examples](https://github.com/Tencent/spring-cloud-tencent/pull/1340)
- [feat: add lane router examples](https://github.com/Tencent/spring-cloud-tencent/pull/1340)
- [fix: fix the lossless provider override in multiple registries scenario](https://github.com/Tencent/spring-cloud-tencent/pull/1341)

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