Interface ConfigService


  • public interface ConfigService
    Config Service Interface
    Author:
    Nacos
    • Method Detail

      • getConfig

        String getConfig​(String dataId,
                         String group,
                         long timeoutMs)
                  throws NacosException
        Get config
        Parameters:
        dataId - dataId
        group - group
        timeoutMs - read timeout
        Returns:
        config value
        Throws:
        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 provided, use the main thread callback, May block other configurations or be blocked by other configurations.
        Parameters:
        dataId - dataId
        group - group
        listener - listener
        Throws:
        NacosException - NacosException
      • publishConfig

        boolean publishConfig​(String dataId,
                              String group,
                              String content)
                       throws NacosException
        Publish config.
        Parameters:
        dataId - dataId
        group - group
        content - content
        Returns:
        Whether publish
        Throws:
        NacosException - NacosException
      • removeConfig

        boolean removeConfig​(String dataId,
                             String group)
                      throws NacosException
        Remove config
        Parameters:
        dataId - dataId
        group - group
        Returns:
        whether remove
        Throws:
        NacosException - NacosException
      • removeListener

        void removeListener​(String dataId,
                            String group,
                            Listener listener)
        Remove listener
        Parameters:
        dataId - dataId
        group - group
        listener - listener
      • getServerStatus

        String getServerStatus()
        Get server status
        Returns:
        whether health