接口 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
    • shutDown

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