public interface ConfigService
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addListener(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.
|
String |
getConfig(String dataId,
String group,
long timeoutMs)
Get config.
|
String |
getConfigAndSignListener(String dataId,
String group,
long timeoutMs,
Listener listener)
Get config and register Listener.
|
String |
getServerStatus()
Get server status.
|
boolean |
publishConfig(String dataId,
String group,
String content)
Publish config.
|
boolean |
removeConfig(String dataId,
String group)
Remove config.
|
void |
removeListener(String dataId,
String group,
Listener listener)
Remove listener.
|
void |
shutDown()
Shutdown the resource service.
|
String getConfig(String dataId, String group, long timeoutMs) throws NacosException
dataId - dataIdgroup - grouptimeoutMs - read timeoutNacosException - NacosExceptionString getConfigAndSignListener(String dataId, String group, long timeoutMs, Listener listener) throws NacosException
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 - dataIdgroup - grouptimeoutMs - read timeoutlistener - ListenerNacosException - NacosExceptionvoid addListener(String dataId, String group, Listener listener) throws NacosException
dataId - dataIdgroup - grouplistener - listenerNacosException - NacosExceptionboolean publishConfig(String dataId, String group, String content) throws NacosException
dataId - dataIdgroup - groupcontent - contentNacosException - NacosExceptionboolean removeConfig(String dataId, String group) throws NacosException
dataId - dataIdgroup - groupNacosException - NacosExceptionvoid removeListener(String dataId, String group, Listener listener)
dataId - dataIdgroup - grouplistener - listenerString getServerStatus()
void shutDown()
throws NacosException
NacosException - exception.Copyright © 2018–2020 Alibaba Group. All rights reserved.