Package io.vertx.reactivex.config
Class ConfigRetriever
- java.lang.Object
-
- io.vertx.reactivex.config.ConfigRetriever
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<ConfigRetriever>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description ConfigRetriever(ConfigRetriever delegate)
ConfigRetriever(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the retriever.ReadStream<JsonObject>
configStream()
static ConfigRetriever
create(Vertx vertx)
Creates an instance of the default implementation of theConfigRetriever
, 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 theConfigRetriever
.boolean
equals(Object o)
JsonObject
getCachedConfig()
Gets the last computed configuration.void
getConfig()
Reads the configuration from the different and computes the final configuration.void
getConfig(Handler<AsyncResult<JsonObject>> completionHandler)
Reads the configuration from the different and computes the final configuration.ConfigRetriever
getDelegate()
int
hashCode()
void
listen(Handler<ConfigChange> listener)
Registers a listener receiving configuration changes.static ConfigRetriever
newInstance(ConfigRetriever arg)
io.reactivex.Single<JsonObject>
rxGetConfig()
Reads the configuration from the different and computes the final configuration.ConfigRetriever
setBeforeScanHandler(Handler<Void> handler)
Registers a handler called before every scan.ConfigRetriever
setConfigurationProcessor(Function<JsonObject,JsonObject> processor)
Registers a handler that process the configuration before being injected intogetConfig(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>)
orlisten(io.vertx.core.Handler<io.vertx.config.ConfigChange>)
.String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<ConfigRetriever> __TYPE_ARG
-
-
Constructor Detail
-
ConfigRetriever
public ConfigRetriever(ConfigRetriever delegate)
-
ConfigRetriever
public ConfigRetriever(Object delegate)
-
-
Method Detail
-
getDelegate
public ConfigRetriever getDelegate()
-
create
public static ConfigRetriever create(Vertx vertx, ConfigRetrieverOptions options)
Creates an instance of the default implementation of theConfigRetriever
.- Parameters:
vertx
- the vert.x instanceoptions
- the options, must not benull
, must contain the list of configured store.- Returns:
- the created instance.
-
create
public static ConfigRetriever create(Vertx vertx)
Creates an instance of the default implementation of theConfigRetriever
, using the default settings (json file, system properties and environment variables).- Parameters:
vertx
- the vert.x instance- Returns:
- the created instance.
-
getConfig
public void getConfig(Handler<AsyncResult<JsonObject>> completionHandler)
Reads the configuration from the different and computes the final configuration.- Parameters:
completionHandler
- handler receiving the computed configuration, or a failure if the configuration cannot be retrieved
-
getConfig
public void getConfig()
Reads the configuration from the different and computes the final configuration.
-
rxGetConfig
public io.reactivex.Single<JsonObject> rxGetConfig()
Reads the configuration from the different and computes the final configuration.- Returns:
-
close
public void close()
Closes the retriever.
-
getCachedConfig
public JsonObject getCachedConfig()
Gets the last computed configuration.- Returns:
- the last configuration
-
listen
public void listen(Handler<ConfigChange> listener)
Registers a listener receiving configuration changes. This method cannot only be called if the configuration is broadcasted.- Parameters:
listener
- the listener
-
setBeforeScanHandler
public ConfigRetriever setBeforeScanHandler(Handler<Void> handler)
Registers a handler called before every scan. This method is mostly used for logging purpose.- Parameters:
handler
- the handler, must not benull
- Returns:
- the current config retriever
-
setConfigurationProcessor
public ConfigRetriever setConfigurationProcessor(Function<JsonObject,JsonObject> processor)
Registers a handler that process the configuration before being injected intogetConfig(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>)
orlisten(io.vertx.core.Handler<io.vertx.config.ConfigChange>)
. This allows the code to customize the configuration.- Parameters:
processor
- the processor, must not benull
. The method must not returnnull
. 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 thegetConfig(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>)
handler.- Returns:
- the current config retriever
-
configStream
public ReadStream<JsonObject> configStream()
- Returns:
- the stream of configurations. It's single stream (unicast) and that delivers the last known config and the successors periodically.
-
newInstance
public static ConfigRetriever newInstance(ConfigRetriever arg)
-
-