Skip to content
Permalink
Browse files
GovernanceConfiguration use dubbo instead DynamicConfiguration (#840)
* GovernanceConfiguration use dubbo instead DynamicConfiguration

* remove useless change
  • Loading branch information
haoyann committed Nov 8, 2021
1 parent e14a255 commit 906e87122f39527c54086db0d66fb04bcf746ba6
Showing 16 changed files with 135 additions and 689 deletions.
@@ -26,6 +26,7 @@ public class Constants {
public static final String REGISTRY_ADDRESS = "dubbo.registry.address";
public static final String METADATA_ADDRESS = "dubbo.metadata-report.address";
public static final String DEFAULT_ROOT = "dubbo";
public static final String DEFAULT_GROUP = "dubbo";
public static final String PATH_SEPARATOR = "/";
public static final String GROUP_KEY = "group";
public static final String NAMESPACE_KEY = "namespace";
@@ -74,7 +75,7 @@ public class Constants {
public static final String CONSUMERS_CATEGORY = "consumers";
public static final String SPECIFICATION_VERSION_KEY = "release";
public static final String GLOBAL_CONFIG = "global";
public static final String GLOBAL_CONFIG_PATH = "config/dubbo/dubbo.properties";
public static final String GLOBAL_CONFIG_PATH = "dubbo.properties";
public static final String METRICS_PORT = "metrics.port";
public static final String METRICS_PROTOCOL = "metrics.protocol";
public static final Set<String> CONFIGS = new HashSet<>();
@@ -103,10 +103,10 @@ GovernanceConfiguration getDynamicConfiguration() {

if (StringUtils.isNotEmpty(configCenter)) {
configCenterUrl = formUrl(configCenter, configCenterGroup, configCenterGroupNameSpace, username, password);
dynamicConfiguration = ExtensionLoader.getExtensionLoader(GovernanceConfiguration.class).getExtension(configCenterUrl.getProtocol());
dynamicConfiguration = ExtensionLoader.getExtensionLoader(GovernanceConfiguration.class).getDefaultExtension();
dynamicConfiguration.setUrl(configCenterUrl);
dynamicConfiguration.init();
String config = dynamicConfiguration.getConfig(Constants.GLOBAL_CONFIG_PATH);
String config = dynamicConfiguration.getConfig(Constants.DUBBO_PROPERTY);

if (StringUtils.isNotEmpty(config)) {
Arrays.stream(config.split("\n")).forEach(s -> {
@@ -122,7 +122,7 @@ GovernanceConfiguration getDynamicConfiguration() {
if (dynamicConfiguration == null) {
if (StringUtils.isNotEmpty(registryAddress)) {
registryUrl = formUrl(registryAddress, registryGroup, registryNameSpace, username, password);
dynamicConfiguration = ExtensionLoader.getExtensionLoader(GovernanceConfiguration.class).getExtension(registryUrl.getProtocol());
dynamicConfiguration = ExtensionLoader.getExtensionLoader(GovernanceConfiguration.class).getDefaultExtension();
dynamicConfiguration.setUrl(registryUrl);
dynamicConfiguration.init();
logger.warn("you are using dubbo.registry.address, which is not recommend, please refer to: https://github.com/apache/incubator-dubbo-admin/wiki/Dubbo-Admin-configuration");
@@ -21,20 +21,21 @@
import org.apache.dubbo.common.extension.SPI;


@SPI("zookeeper")
@SPI("multi")
public interface GovernanceConfiguration {
void init();

void setUrl(URL url);

URL getUrl();
String setConfig(String key, String value);

boolean setConfig(String key, String value);

String getConfig(String key);

boolean deleteConfig(String key);

String setConfig(String group, String key, String value);
boolean setConfig(String group, String key, String value);

String getConfig(String group, String key);

This file was deleted.

This file was deleted.

0 comments on commit 906e871

Please sign in to comment.