类 ApolloDynamicConfiguration

  • 所有已实现的接口:
    AutoCloseable, DynamicConfiguration, Configuration

    public class ApolloDynamicConfiguration
    extends Object
    implements DynamicConfiguration
    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: , '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.
    • 方法详细资料

      • addListener

        public void addListener​(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.
        指定者:
        addListener 在接口中 DynamicConfiguration
        参数:
        key - the key to represent a configuration
        group - the group where the key belongs to
        listener - configuration listener
      • getConfig

        public String getConfig​(String key,
                                String group,
                                long timeout)
                         throws IllegalStateException
        从接口复制的说明: DynamicConfiguration
        Get the configuration mapped to the given key and the given group. If the configuration fails to fetch after timeout exceeds, IllegalStateException will be thrown.
        指定者:
        getConfig 在接口中 DynamicConfiguration
        参数:
        key - the key to represent a configuration
        group - the group where the key belongs to
        timeout - timeout value for fetching the target config
        返回:
        target configuration mapped to the given key and the given group, IllegalStateException will be thrown if timeout exceeds.
        抛出:
        IllegalStateException
      • getProperties

        public String getProperties​(String key,
                                    String group,
                                    long timeout)
                             throws IllegalStateException
        Recommend specify namespace and group when using Apollo.

        , 'dubbo=governance' is for governance rules while 'group=dubbo' is for properties files.

        指定者:
        getProperties 在接口中 DynamicConfiguration
        参数:
        key - default value is 'dubbo.properties', currently useless for Apollo.
        group -
        timeout -
        返回:
        抛出:
        IllegalStateException
      • getInternalProperty

        public String getInternalProperty​(String key)
        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 .
        指定者:
        getInternalProperty 在接口中 Configuration