public class ConfigRetrieverImpl extends Object implements ConfigRetriever
ConfigRetriever.| Constructor and Description |
|---|
ConfigRetrieverImpl(Vertx vertx,
ConfigRetrieverOptions options) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the retriever.
|
ReadStream<JsonObject> |
configStream() |
JsonObject |
getCachedConfig()
Gets the last computed configuration.
|
void |
getConfig(Handler<AsyncResult<JsonObject>> completionHandler)
Reads the configuration from the different
ConfigStore
and computes the final configuration. |
List<ConfigurationProvider> |
getProviders() |
void |
initializePeriodicScan() |
void |
listen(Handler<ConfigChange> listener)
Registers a listener receiving configuration changes.
|
ConfigRetriever |
setBeforeScanHandler(Handler<Void> function)
Registers a handler called before every scan.
|
ConfigRetriever |
setConfigurationProcessor(Function<JsonObject,JsonObject> processor)
Registers a handler that process the configuration before being injected into
ConfigRetriever.getConfig(Handler) or ConfigRetriever.listen(Handler). |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, create, getConfigAsFuturepublic ConfigRetrieverImpl(Vertx vertx, ConfigRetrieverOptions options)
public void initializePeriodicScan()
public void getConfig(Handler<AsyncResult<JsonObject>> completionHandler)
ConfigRetrieverConfigStore
and computes the final configuration.getConfig in interface ConfigRetrievercompletionHandler - handler receiving the computed configuration, or a failure if the
configuration cannot be retrievedpublic void close()
ConfigRetrieverclose in interface ConfigRetrieverpublic JsonObject getCachedConfig()
ConfigRetrievergetCachedConfig in interface ConfigRetrieverpublic void listen(Handler<ConfigChange> listener)
ConfigRetrieverlisten in interface ConfigRetrieverlistener - the listenerpublic ConfigRetriever setBeforeScanHandler(Handler<Void> function)
ConfigRetrieversetBeforeScanHandler in interface ConfigRetrieverfunction - the function, must not be nullpublic ConfigRetriever setConfigurationProcessor(Function<JsonObject,JsonObject> processor)
ConfigRetrieverConfigRetriever.getConfig(Handler) or ConfigRetriever.listen(Handler). This allows
the code to customize the configuration.setConfigurationProcessor in interface ConfigRetrieverprocessor - the processor, must not be null. The method must not return null. The returned configuration is used. If the processor
does not update the configuration, it must return the input configuration. If the processor throws an exception, the failure is passed
to the ConfigRetriever.getConfig(Handler) handler.public ReadStream<JsonObject> configStream()
configStream in interface ConfigRetrieverpublic List<ConfigurationProvider> getProviders()
Copyright © 2020. All rights reserved.