接口 ConfigService
-
public interface ConfigServiceConfig Service Interface.- 作者:
- Nacos
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 voidaddListener(java.lang.String dataId, java.lang.String group, Listener listener)Add a listener to the configuration, after the server modified the configuration, the client will use the incoming listener callback.java.lang.StringgetConfig(java.lang.String dataId, java.lang.String group, long timeoutMs)Get config.java.lang.StringgetConfigAndSignListener(java.lang.String dataId, java.lang.String group, long timeoutMs, Listener listener)Get config and register Listener.java.lang.StringgetServerStatus()Get server status.booleanpublishConfig(java.lang.String dataId, java.lang.String group, java.lang.String content)Publish config.booleanpublishConfig(java.lang.String dataId, java.lang.String group, java.lang.String content, java.lang.String type)Publish config.booleanpublishConfigCas(java.lang.String dataId, java.lang.String group, java.lang.String content, java.lang.String casMd5)Cas Publish config.booleanpublishConfigCas(java.lang.String dataId, java.lang.String group, java.lang.String content, java.lang.String casMd5, java.lang.String type)Cas Publish config.booleanremoveConfig(java.lang.String dataId, java.lang.String group)Remove config.voidremoveListener(java.lang.String dataId, java.lang.String group, Listener listener)Remove listener.voidshutDown()Shutdown the resource service.
-
-
-
方法详细资料
-
getConfig
java.lang.String getConfig(java.lang.String dataId, java.lang.String group, long timeoutMs) throws NacosExceptionGet config.- 参数:
dataId- dataIdgroup- grouptimeoutMs- read timeout- 返回:
- config value
- 抛出:
NacosException- NacosException
-
getConfigAndSignListener
java.lang.String getConfigAndSignListener(java.lang.String dataId, java.lang.String group, long timeoutMs, Listener listener) throws NacosExceptionGet 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- dataIdgroup- grouptimeoutMs- read timeoutlistener-Listener- 返回:
- config value
- 抛出:
NacosException- NacosException
-
addListener
void addListener(java.lang.String dataId, java.lang.String group, Listener listener) throws NacosExceptionAdd 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- dataIdgroup- grouplistener- listener- 抛出:
NacosException- NacosException
-
publishConfig
boolean publishConfig(java.lang.String dataId, java.lang.String group, java.lang.String content) throws NacosExceptionPublish config.- 参数:
dataId- dataIdgroup- groupcontent- content- 返回:
- Whether publish
- 抛出:
NacosException- NacosException
-
publishConfig
boolean publishConfig(java.lang.String dataId, java.lang.String group, java.lang.String content, java.lang.String type) throws NacosExceptionPublish config.- 参数:
dataId- dataIdgroup- groupcontent- contenttype- config typeConfigType- 返回:
- Whether publish
- 抛出:
NacosException- NacosException
-
publishConfigCas
boolean publishConfigCas(java.lang.String dataId, java.lang.String group, java.lang.String content, java.lang.String casMd5) throws NacosExceptionCas Publish config.- 参数:
dataId- dataIdgroup- groupcontent- contentcasMd5- casMd5 prev content's md5 to cas.- 返回:
- Whether publish
- 抛出:
NacosException- NacosException
-
publishConfigCas
boolean publishConfigCas(java.lang.String dataId, java.lang.String group, java.lang.String content, java.lang.String casMd5, java.lang.String type) throws NacosExceptionCas Publish config.- 参数:
dataId- dataIdgroup- groupcontent- contentcasMd5- casMd5 prev content's md5 to cas.type- config typeConfigType- 返回:
- Whether publish
- 抛出:
NacosException- NacosException
-
removeConfig
boolean removeConfig(java.lang.String dataId, java.lang.String group) throws NacosExceptionRemove config.- 参数:
dataId- dataIdgroup- group- 返回:
- whether remove
- 抛出:
NacosException- NacosException
-
removeListener
void removeListener(java.lang.String dataId, java.lang.String group, Listener listener)Remove listener.- 参数:
dataId- dataIdgroup- grouplistener- listener
-
getServerStatus
java.lang.String getServerStatus()
Get server status.- 返回:
- whether health
-
shutDown
void shutDown() throws NacosExceptionShutdown the resource service.- 抛出:
NacosException- exception.
-
-