public interface ConfigRetriever
ConfigStore
and tracks changes periodically.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the retriever.
|
ReadStream<JsonObject> |
configStream() |
static ConfigRetriever |
create(Vertx vertx)
Creates an instance of the default implementation of the
ConfigRetriever , using the default
settings (json file, system properties and environment variables). |
static ConfigRetriever |
create(Vertx vertx,
ConfigRetrieverOptions options)
Creates an instance of the default implementation of the
ConfigRetriever . |
JsonObject |
getCachedConfig()
Gets the last computed configuration.
|
Future<JsonObject> |
getConfig()
Like
getConfig(Handler) but returns a Future of the asynchronous result |
void |
getConfig(Handler<AsyncResult<JsonObject>> completionHandler)
Reads the configuration from the different
ConfigStore
and computes the final configuration. |
void |
listen(Handler<ConfigChange> listener)
Registers a listener receiving configuration changes.
|
ConfigRetriever |
setBeforeScanHandler(Handler<Void> handler)
Registers a handler called before every scan.
|
ConfigRetriever |
setConfigurationProcessor(java.util.function.Function<JsonObject,JsonObject> processor)
Registers a handler that process the configuration before being injected into
getConfig(Handler) or listen(Handler) . |
static ConfigRetriever create(Vertx vertx, ConfigRetrieverOptions options)
ConfigRetriever
.vertx
- the vert.x instanceoptions
- the options, must not be null
, must contain the list of configured store.static ConfigRetriever create(Vertx vertx)
ConfigRetriever
, using the default
settings (json file, system properties and environment variables).vertx
- the vert.x instancevoid getConfig(Handler<AsyncResult<JsonObject>> completionHandler)
ConfigStore
and computes the final configuration.completionHandler
- handler receiving the computed configuration, or a failure if the
configuration cannot be retrievedFuture<JsonObject> getConfig()
getConfig(Handler)
but returns a Future
of the asynchronous resultvoid close()
JsonObject getCachedConfig()
void listen(Handler<ConfigChange> listener)
listener
- the listenerConfigRetriever setBeforeScanHandler(Handler<Void> handler)
handler
- the handler, must not be null
ConfigRetriever setConfigurationProcessor(java.util.function.Function<JsonObject,JsonObject> processor)
getConfig(Handler)
or listen(Handler)
. This allows
the code to customize the configuration.processor
- 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 getConfig(Handler)
handler.ReadStream<JsonObject> configStream()
Copyright © 2022 Eclipse. All rights reserved.