Class ConfigRetriever

java.lang.Object
io.vertx.mutiny.config.ConfigRetriever
All Implemented Interfaces:
MutinyDelegate

public class ConfigRetriever extends Object implements MutinyDelegate
Defines a configuration retriever that read configuration from ConfigStore and tracks changes periodically.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

Author:
Clement Escoffier
See Also:
  • ConfigRetriever
  • Field Details

  • Constructor Details

    • ConfigRetriever

      public ConfigRetriever(io.vertx.config.ConfigRetriever delegate)
      Create a new instance of ConfigRetriever delegating to the given (non-null) instance of ConfigRetriever.
    • ConfigRetriever

      public ConfigRetriever(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.config.ConfigRetriever getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • getConfig

      @CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> getConfig()
      Reads the configuration from the different ConfigStore and computes the final configuration.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • ConfigRetriever.getConfig()
    • getConfigAndAwait

      public io.vertx.core.json.JsonObject getConfigAndAwait()
      Reads the configuration from the different ConfigStore and computes the final configuration.

      Unlike the bare Vert.x variant, this method returns a JsonObject. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Returns:
      The operation result
      See Also:
      • ConfigRetriever.getConfig()
    • getConfigAndForget

      public ConfigRetriever getConfigAndForget()
      Reads the configuration from the different ConfigStore and computes the final configuration.

      Unlike the bare Vert.x variant, this method ignores the JsonObject result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • ConfigRetriever.getConfig()
    • close

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
      Closes the retriever.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • ConfigRetriever.close()
    • closeAndAwait

      public void closeAndAwait()
      Closes the retriever.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      See Also:
      • ConfigRetriever.close()
    • closeAndForget

      public ConfigRetriever closeAndForget()
      Closes the retriever.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • ConfigRetriever.close()
    • create

      public static ConfigRetriever create(Vertx vertx, io.vertx.config.ConfigRetrieverOptions options)
      Creates an instance of the default implementation of the ConfigRetriever.
      Parameters:
      vertx - the vert.x instance
      options - the options, must not be null, 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 the ConfigRetriever, using the default settings (json file, system properties and environment variables).
      Parameters:
      vertx - the vert.x instance
      Returns:
      the created instance.
    • getCachedConfig

      public io.vertx.core.json.JsonObject getCachedConfig()
      Gets the last computed configuration.
      Returns:
      the last configuration
    • listen

      public void listen(Consumer<io.vertx.config.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(Runnable handler)
      Registers a handler called before every scan. This method is mostly used for logging purpose.
      Parameters:
      handler - the handler, must not be null
      Returns:
      the current config retriever
    • setConfigurationProcessor

      public ConfigRetriever setConfigurationProcessor(Function<io.vertx.core.json.JsonObject,io.vertx.core.json.JsonObject> processor)
      Registers a handler that process the configuration before being injected into #getConfig(Handler) or #listen(Handler). This allows the code to customize the configuration.
      Parameters:
      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.
      Returns:
      the current config retriever
    • configStream

      public ReadStream<io.vertx.core.json.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(io.vertx.config.ConfigRetriever delegate)
      Creates a new instance of the ConfigRetriever.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object