From 057189e231d6dd32d4523dfa48ea800349a5b5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BB=B6?= <1060026287@qq.com> Date: Fri, 26 Mar 2021 14:00:52 +0800 Subject: [PATCH] [ISSUE-#7449] Script protocol also handle as config. (#7447) --- .../org/apache/dubbo/common/constants/RegistryConstants.java | 2 ++ .../dubbo/registry/support/CacheableFailbackRegistry.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java index bd8f43ccb0..d0f41af93b 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java @@ -55,6 +55,8 @@ public interface RegistryConstants { String ROUTE_PROTOCOL = "route"; + String ROUTE_SCRIPT_PROTOCOL = "script"; + String OVERRIDE_PROTOCOL = "override"; String COMPATIBLE_CONFIG_KEY = "compatible_config"; diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java index ec3f3cafd3..3289594eed 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java @@ -57,6 +57,7 @@ import static org.apache.dubbo.common.constants.RegistryConstants.CATEGORY_KEY; import static org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL; import static org.apache.dubbo.common.constants.RegistryConstants.OVERRIDE_PROTOCOL; import static org.apache.dubbo.common.constants.RegistryConstants.ROUTE_PROTOCOL; +import static org.apache.dubbo.common.constants.RegistryConstants.ROUTE_SCRIPT_PROTOCOL; import static org.apache.dubbo.common.url.component.DubboServiceAddressURL.PROVIDER_FIRST_KEYS; /** @@ -165,7 +166,7 @@ public abstract class CacheableFailbackRegistry extends FailbackRegistry { urls = new ArrayList<>(1); } else { String rawProvider = providers.iterator().next(); - if (rawProvider.startsWith(OVERRIDE_PROTOCOL) || rawProvider.startsWith(ROUTE_PROTOCOL)) { + if (rawProvider.startsWith(OVERRIDE_PROTOCOL) || rawProvider.startsWith(ROUTE_PROTOCOL) || rawProvider.startsWith(ROUTE_SCRIPT_PROTOCOL)) { urls = toConfiguratorsWithoutEmpty(consumer, providers); } else { urls = toUrlsWithoutEmpty(consumer, providers);