接口 DynamicConfiguration

    • 方法详细资料

      • addListener

        void addListener​(String key,
                         String group,
                         ConfigurationListener listener)
        Register a configuration listener for a specified key The listener only works for service governance purpose, so the target group would always be the value user specifies at startup or 'dubbo' by default. This method will only register listener, which means it will not trigger a notification that contains the current value.
        参数:
        key - the key to represent a configuration
        group - the group where the key belongs to
        listener - configuration listener
      • removeListener

        void removeListener​(String key,
                            String group,
                            ConfigurationListener listener)
        Stops one listener from listening to value changes in the specified key.
        参数:
        key - the key to represent a configuration
        group - the group where the key belongs to
        listener - configuration listener
      • getConfig

        default String getConfig​(String key,
                                 String group)
        Get the configuration mapped to the given key and the given group with the default timeout
        参数:
        key - the key to represent a configuration
        group - the group where the key belongs to
        返回:
        target configuration mapped to the given key and the given group
      • getConfig

        String getConfig​(String key,
                         String group,
                         long timeout)
                  throws IllegalStateException
        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.
        参数:
        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
      • publishConfig

        default boolean publishConfig​(String key,
                                      String group,
                                      String content)
                               throws UnsupportedOperationException
        Publish Config mapped to the given key and the given group.
        参数:
        key - the key to represent a configuration
        group - the group where the key belongs to
        content - the content of configuration
        返回:
        true if success, or false
        抛出:
        UnsupportedOperationException - If the under layer does not support
        从以下版本开始:
        2.7.5
      • getDefaultGroup

        default String getDefaultGroup()
        Get the default group for the operations
        返回:
        The default value is "dubbo"
        从以下版本开始:
        2.7.5
      • getDefaultTimeout

        default long getDefaultTimeout()
        Get the default timeout for the operations in milliseconds
        返回:
        The default value is -1L
        从以下版本开始:
        2.7.5
      • getDynamicConfiguration

        static DynamicConfiguration getDynamicConfiguration()
        Find DynamicConfiguration instance
        返回:
        DynamicConfiguration instance
      • getDynamicConfiguration

        static DynamicConfiguration getDynamicConfiguration​(URL connectionURL)
        Get the instance of DynamicConfiguration by the specified connection URL
        参数:
        connectionURL -
        返回:
        non-null
        从以下版本开始:
        2.7.5
      • getRuleKey

        static String getRuleKey​(URL url)
        The format is '{interfaceName}:[version]:[group]'
        返回:
      • removeConfig

        default boolean removeConfig​(String key,
                                     String group)
        参数:
        key - the key to represent a configuration
        group - the group where the key belongs to
        返回:
        true if success, or false
        从以下版本开始:
        2.7.8