接口 ConfigService


public interface ConfigService
Config Service Interface.
作者:
Nacos
  • 方法详细资料

    • getConfig

      String getConfig(String dataId, String group, long timeoutMs) throws NacosException
      Get config.
      参数:
      dataId - dataId
      group - group
      timeoutMs - read timeout
      返回:
      config value
      抛出:
      NacosException - NacosException
    • getConfigAndSignListener

      String getConfigAndSignListener(String dataId, String group, long timeoutMs, Listener listener) throws NacosException
      Get config and register Listener.

      If you want to pull it yourself when the program starts to get the configuration for the first time, and the registered Listener is used for future configuration updates, you can keep the original code unchanged, just add the system parameter: enableRemoteSyncConfig = "true" ( But there is network overhead); therefore we recommend that you use this interface directly

      参数:
      dataId - dataId
      group - group
      timeoutMs - read timeout
      listener - Listener
      返回:
      config value
      抛出:
      NacosException - NacosException
    • addListener

      void addListener(String dataId, String group, Listener listener) throws NacosException
      Add a listener to the configuration, after the server modified the configuration, the client will use the incoming listener callback. Recommended asynchronous processing, the application can implement the getExecutor method in the ManagerListener, provide a thread pool of execution. If not provided, use the main thread callback, May block other configurations or be blocked by other configurations.
      参数:
      dataId - dataId
      group - group
      listener - listener
      抛出:
      NacosException - NacosException
    • publishConfig

      boolean publishConfig(String dataId, String group, String content) throws NacosException
      Publish config.
      参数:
      dataId - dataId
      group - group
      content - content
      返回:
      Whether publish
      抛出:
      NacosException - NacosException
    • publishConfig

      boolean publishConfig(String dataId, String group, String content, String type) throws NacosException
      Publish config.
      参数:
      dataId - dataId
      group - group
      content - content
      type - config type ConfigType
      返回:
      Whether publish
      抛出:
      NacosException - NacosException
    • publishConfigCas

      boolean publishConfigCas(String dataId, String group, String content, String casMd5) throws NacosException
      Cas Publish config.
      参数:
      dataId - dataId
      group - group
      content - content
      casMd5 - casMd5 prev content's md5 to cas.
      返回:
      Whether publish
      抛出:
      NacosException - NacosException
    • publishConfigCas

      boolean publishConfigCas(String dataId, String group, String content, String casMd5, String type) throws NacosException
      Cas Publish config.
      参数:
      dataId - dataId
      group - group
      content - content
      casMd5 - casMd5 prev content's md5 to cas.
      type - config type ConfigType
      返回:
      Whether publish
      抛出:
      NacosException - NacosException
    • removeConfig

      boolean removeConfig(String dataId, String group) throws NacosException
      Remove config.
      参数:
      dataId - dataId
      group - group
      返回:
      whether remove
      抛出:
      NacosException - NacosException
    • removeListener

      void removeListener(String dataId, String group, Listener listener)
      Remove listener.
      参数:
      dataId - dataId
      group - group
      listener - listener
    • getServerStatus

      String getServerStatus()
      Get server status.
      返回:
      whether health
    • addConfigFilter

      void addConfigFilter(IConfigFilter configFilter)
      add config filter. It is recommended to use AbstractConfigFilter to expand the filter.
      参数:
      configFilter - filter
      从以下版本开始:
      2.3.0
    • shutDown

      void shutDown() throws NacosException
      Shutdown the resource service.
      抛出:
      NacosException - exception.
    • fuzzyWatch

      void fuzzyWatch(String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException
      Add a fuzzy listener to the configuration. After the server modifies the configuration matching the specified fixed group name, the client will utilize the incoming fuzzy listener callback. Fuzzy listeners allow for pattern-based subscription to configurations, where the fixed group name represents the group and dataId patterns specified for subscription.
      参数:
      groupNamePattern - The group name pattern representing the group and dataId patterns to subscribe to.
      watcher - The fuzzy watcher to be added.
      抛出:
      NacosException - NacosException
      从以下版本开始:
      3.0
    • fuzzyWatch

      void fuzzyWatch(String dataIdPattern, String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException
      Add a fuzzy listener to the configuration. After the server modifies the configuration matching the specified dataId pattern and fixed group name, the client will utilize the incoming fuzzy listener callback. Fuzzy listeners allow for pattern-based subscription to configurations.
      参数:
      dataIdPattern - The pattern to match dataIds for subscription.
      groupNamePattern - The pattern to match group name representing the group and dataId patterns to subscribe to.
      watcher - The fuzzy listener to be added.
      抛出:
      NacosException - NacosException
      从以下版本开始:
      3.0
    • fuzzyWatchWithGroupKeys

      Future<Set<String>> fuzzyWatchWithGroupKeys(String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException
      Add a fuzzy listener to the configuration and retrieve all configs that match the specified fixed group name. Fuzzy listeners allow for pattern-based subscription to configs, where the fixed group name represents the group and dataId patterns specified for subscription.
      参数:
      groupNamePattern - The group name pattern representing the group and dataId patterns to subscribe to.
      watcher - The fuzzy watcher to be added.
      返回:
      CompletableFuture containing collection of configs that match the specified fixed group name.
      抛出:
      NacosException - NacosException
      从以下版本开始:
      3.0
    • fuzzyWatchWithGroupKeys

      Future<Set<String>> fuzzyWatchWithGroupKeys(String dataIdPattern, String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException
      Add a fuzzy listener to the configuration and retrieve all configs that match the specified dataId pattern and fixed group name. Fuzzy listeners allow for pattern-based subscription to configs.
      参数:
      dataIdPattern - The pattern to match dataIds for subscription.
      groupNamePattern - The group name pattern representing the group and dataId patterns to subscribe to.
      watcher - The fuzzy watcher to be added.
      返回:
      CompletableFuture containing collection of configs that match the specified dataId pattern and fixed group name.
      抛出:
      NacosException - NacosException
      从以下版本开始:
      3.0
    • cancelFuzzyWatch

      void cancelFuzzyWatch(String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException
      Cancel fuzzy listen and remove the event listener for a specified fixed group name.
      参数:
      groupNamePattern - The group name pattern for fuzzy watch.
      watcher - The event watcher to be removed.
      抛出:
      NacosException - If an error occurs during the cancellation process.
      从以下版本开始:
      3.0
    • cancelFuzzyWatch

      void cancelFuzzyWatch(String dataIdPattern, String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException
      Cancel fuzzy listen and remove the event listener for a specified service name pattern and fixed group name.
      参数:
      dataIdPattern - The pattern to match dataId for fuzzy watch.
      groupNamePattern - The group name pattern for fuzzy watch.
      watcher - The event listener to be removed.
      抛出:
      NacosException - If an error occurs during the cancellation process.
      从以下版本开始:
      3.0