接口 ConfigService
public interface ConfigService
Config Service Interface.
- 作者:
- Nacos
-
方法概要
修饰符和类型方法说明voidaddConfigFilter(IConfigFilter configFilter) add config filter.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.voidcancelFuzzyWatch(String groupNamePattern, FuzzyWatchEventWatcher watcher) Cancel fuzzy listen and remove the event listener for a specified fixed group name.voidcancelFuzzyWatch(String dataIdPattern, String groupNamePattern, FuzzyWatchEventWatcher watcher) Cancel fuzzy listen and remove the event listener for a specified service name pattern and fixed group name.voidfuzzyWatch(String groupNamePattern, FuzzyWatchEventWatcher watcher) Add a fuzzy listener to the configuration.voidfuzzyWatch(String dataIdPattern, String groupNamePattern, FuzzyWatchEventWatcher watcher) Add a fuzzy listener to the configuration.fuzzyWatchWithGroupKeys(String groupNamePattern, FuzzyWatchEventWatcher watcher) Add a fuzzy listener to the configuration and retrieve all configs that match the specified fixed group name.fuzzyWatchWithGroupKeys(String dataIdPattern, String groupNamePattern, FuzzyWatchEventWatcher watcher) Add a fuzzy listener to the configuration and retrieve all configs that match the specified dataId pattern and fixed group name.Get config.getConfigAndSignListener(String dataId, String group, long timeoutMs, Listener listener) Get config and register Listener.Get server status.booleanpublishConfig(String dataId, String group, String content) Publish config.booleanpublishConfig(String dataId, String group, String content, String type) Publish config.booleanpublishConfigCas(String dataId, String group, String content, String casMd5) Cas Publish config.booleanCas Publish config.booleanremoveConfig(String dataId, String group) Remove config.voidremoveListener(String dataId, String group, Listener listener) Remove listener.voidshutDown()Shutdown the resource service.
-
方法详细资料
-
getConfig
Get config.- 参数:
dataId- dataIdgroup- grouptimeoutMs- 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- dataIdgroup- grouptimeoutMs- read timeoutlistener-Listener- 返回:
- config value
- 抛出:
NacosException- NacosException
-
addListener
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- dataIdgroup- grouplistener- listener- 抛出:
NacosException- NacosException
-
publishConfig
Publish config.- 参数:
dataId- dataIdgroup- groupcontent- content- 返回:
- Whether publish
- 抛出:
NacosException- NacosException
-
publishConfig
boolean publishConfig(String dataId, String group, String content, String type) throws NacosException Publish config.- 参数:
dataId- dataIdgroup- groupcontent- contenttype- config typeConfigType- 返回:
- Whether publish
- 抛出:
NacosException- NacosException
-
publishConfigCas
boolean publishConfigCas(String dataId, String group, String content, String casMd5) throws NacosException Cas Publish config.- 参数:
dataId- dataIdgroup- groupcontent- contentcasMd5- 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- dataIdgroup- groupcontent- contentcasMd5- casMd5 prev content's md5 to cas.type- config typeConfigType- 返回:
- Whether publish
- 抛出:
NacosException- NacosException
-
removeConfig
Remove config.- 参数:
dataId- dataIdgroup- group- 返回:
- whether remove
- 抛出:
NacosException- NacosException
-
removeListener
Remove listener.- 参数:
dataId- dataIdgroup- grouplistener- listener
-
getServerStatus
String getServerStatus()Get server status.- 返回:
- whether health
-
addConfigFilter
add config filter. It is recommended to useAbstractConfigFilterto expand the filter.- 参数:
configFilter- filter- 从以下版本开始:
- 2.3.0
-
shutDown
Shutdown the resource service.- 抛出:
NacosException- exception.
-
fuzzyWatch
Add a fuzzy listener to the configuration. After the server modifies the configuration matching the specified fixed group name, the client will utilize the incoming fuzzy listener callback. Fuzzy listeners allow for pattern-based subscription to configurations, where the fixed group name represents the group and dataId patterns specified for subscription.- 参数:
groupNamePattern- The group name pattern representing the group and dataId patterns to subscribe to.watcher- The fuzzy watcher to be added.- 抛出:
NacosException- NacosException- 从以下版本开始:
- 3.0
-
fuzzyWatch
void fuzzyWatch(String dataIdPattern, String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException Add a fuzzy listener to the configuration. After the server modifies the configuration matching the specified dataId pattern and fixed group name, the client will utilize the incoming fuzzy listener callback. Fuzzy listeners allow for pattern-based subscription to configurations.- 参数:
dataIdPattern- The pattern to match dataIds for subscription.groupNamePattern- The pattern to match group name representing the group and dataId patterns to subscribe to.watcher- The fuzzy listener to be added.- 抛出:
NacosException- NacosException- 从以下版本开始:
- 3.0
-
fuzzyWatchWithGroupKeys
Future<Set<String>> fuzzyWatchWithGroupKeys(String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException Add a fuzzy listener to the configuration and retrieve all configs that match the specified fixed group name. Fuzzy listeners allow for pattern-based subscription to configs, where the fixed group name represents the group and dataId patterns specified for subscription.- 参数:
groupNamePattern- The group name pattern representing the group and dataId patterns to subscribe to.watcher- The fuzzy watcher to be added.- 返回:
- CompletableFuture containing collection of configs that match the specified fixed group name.
- 抛出:
NacosException- NacosException- 从以下版本开始:
- 3.0
-
fuzzyWatchWithGroupKeys
Future<Set<String>> fuzzyWatchWithGroupKeys(String dataIdPattern, String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException Add a fuzzy listener to the configuration and retrieve all configs that match the specified dataId pattern and fixed group name. Fuzzy listeners allow for pattern-based subscription to configs.- 参数:
dataIdPattern- The pattern to match dataIds for subscription.groupNamePattern- The group name pattern representing the group and dataId patterns to subscribe to.watcher- The fuzzy watcher to be added.- 返回:
- CompletableFuture containing collection of configs that match the specified dataId pattern and fixed group name.
- 抛出:
NacosException- NacosException- 从以下版本开始:
- 3.0
-
cancelFuzzyWatch
void cancelFuzzyWatch(String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException Cancel fuzzy listen and remove the event listener for a specified fixed group name.- 参数:
groupNamePattern- The group name pattern for fuzzy watch.watcher- The event watcher to be removed.- 抛出:
NacosException- If an error occurs during the cancellation process.- 从以下版本开始:
- 3.0
-
cancelFuzzyWatch
void cancelFuzzyWatch(String dataIdPattern, String groupNamePattern, FuzzyWatchEventWatcher watcher) throws NacosException Cancel fuzzy listen and remove the event listener for a specified service name pattern and fixed group name.- 参数:
dataIdPattern- The pattern to match dataId for fuzzy watch.groupNamePattern- The group name pattern for fuzzy watch.watcher- The event listener to be removed.- 抛出:
NacosException- If an error occurs during the cancellation process.- 从以下版本开始:
- 3.0
-