Package com.alibaba.nacos.api.config
Interface ConfigService
-
public interface ConfigServiceConfig Service Interface- Author:
- Nacos
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(String dataId, String group, Listener listener)Add a listener to the configuration, after the server modified the configuration, the client will use the incoming listener callback.StringgetConfig(String dataId, String group, long timeoutMs)Get configStringgetServerStatus()Get server statusbooleanpublishConfig(String dataId, String group, String content)Publish config.booleanremoveConfig(String dataId, String group)Remove configvoidremoveListener(String dataId, String group, Listener listener)Remove listener
-
-
-
Method Detail
-
getConfig
String getConfig(String dataId, String group, long timeoutMs) throws NacosException
Get config- Parameters:
dataId- dataIdgroup- grouptimeoutMs- 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- dataIdgroup- grouplistener- listener- Throws:
NacosException- NacosException
-
publishConfig
boolean publishConfig(String dataId, String group, String content) throws NacosException
Publish config.- Parameters:
dataId- dataIdgroup- groupcontent- content- Returns:
- Whether publish
- Throws:
NacosException- NacosException
-
removeConfig
boolean removeConfig(String dataId, String group) throws NacosException
Remove config- Parameters:
dataId- dataIdgroup- group- Returns:
- whether remove
- Throws:
NacosException- NacosException
-
removeListener
void removeListener(String dataId, String group, Listener listener)
Remove listener- Parameters:
dataId- dataIdgroup- grouplistener- listener
-
getServerStatus
String getServerStatus()
Get server status- Returns:
- whether health
-
-