Class ApolloDynamicConfiguration
java.lang.Object
org.apache.dubbo.configcenter.support.apollo.ApolloDynamicConfiguration
- All Implemented Interfaces:
AutoCloseable,DynamicConfiguration,Configuration
Apollo implementation, https://github.com/ctripcorp/apollo
Apollo will be used for management of both governance rules and .properties files, by default, these two different kinds of data share the same namespace 'dubbo'. To gain better performance, we recommend separate them by giving namespace and group different values, for example:
invalid input: '<'dubbo:config-center namespace="governance" group="dubbo" />, 'dubbo=governance' is for governance rules while 'group=dubbo' is for properties files.
Please see http://dubbo.apache.org/zh-cn/docs/user/configuration/config-center.html for details.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.apache.dubbo.common.config.Configuration
interfaceLevelLoggerFields inherited from interface org.apache.dubbo.common.config.configcenter.DynamicConfiguration
DEFAULT_GROUP -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(String key, String group, ConfigurationListener listener) Since all governance rules will lay under dubbo group, this method now always uses the default dubboConfig and ignores the group parameter.voidclose()This method will be used by Configuration to get valid value at runtime.getProperties(String key, String group, long timeout) Recommend specify namespace and group when using Apollo.voidremoveListener(String key, String group, ConfigurationListener listener) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.dubbo.common.config.Configuration
containsKey, convert, getBoolean, getBoolean, getBoolean, getInt, getInt, getInteger, getProperty, getProperty, getString, getStringMethods inherited from interface org.apache.dubbo.common.config.configcenter.DynamicConfiguration
addListener, getConfig, getConfigItem, getDefaultGroup, getDefaultTimeout, getProperties, publishConfig, publishConfig, publishConfigCas, removeConfig, removeListener
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDynamicConfiguration
-
addListener
Since all governance rules will lay under dubbo group, this method now always uses the default dubboConfig and ignores the group parameter.- Specified by:
addListenerin interfaceDynamicConfiguration
-
removeListener
- Specified by:
removeListenerin interfaceDynamicConfiguration
-
getConfig
- Specified by:
getConfigin interfaceDynamicConfiguration- Throws:
IllegalStateException
-
getProperties
Recommend specify namespace and group when using Apollo.invalid input: '<'dubbo:config-center namespace="governance" group="dubbo" />, 'dubbo=governance' is for governance rules while 'group=dubbo' is for properties files.
- Specified by:
getPropertiesin interfaceDynamicConfiguration- Parameters:
key- default value is 'dubbo.properties', currently useless for Apollo.group-timeout-- Returns:
- Throws:
IllegalStateException
-
getInternalProperty
This method will be used by Configuration to get valid value at runtime. The group is expected to be 'app level', which can be fetched from the 'config.appnamespace' in url if necessary. But I think Apollo's inheritance feature of namespace can solve the problem .- Specified by:
getInternalPropertyin interfaceConfiguration
-