Class Watch<T>

java.lang.Object
io.vertx.mutiny.ext.consul.Watch<T>
All Implemented Interfaces:
MutinyDelegate

public class Watch<T> extends Object implements MutinyDelegate
Watches are a way of specifying a view of data (e.g. list of nodes, KV pairs, health checks) which is monitored for updates. When an update is detected, an Handler with WatchResult is invoked. All errors, except java.util.concurrent.TimeoutException, will be handled, with resubscribing with a progressive delay. All timeout errors will be ignored, with resubscribing without any delay. As an example, you could watch the status of health checks and notify when a check is critical.

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

Author:
Ruslan Sennov
See Also:
  • Watch
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final TypeArg<Watch>
     
    final TypeArg<T>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Watch(io.vertx.ext.consul.Watch<T> delegate)
    Create a new instance of Watch delegating to the given (non-null) instance of Watch.
    Watch(io.vertx.ext.consul.Watch<T> delegate, TypeArg<T> typeArg_0)
     
    Watch(Object delegate, TypeArg<T> typeArg_0)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    static Watch<io.vertx.ext.consul.EventList>
    events(String event, Vertx vertx)
    Creates Watch to monitoring the custom user events.
    static Watch<io.vertx.ext.consul.EventList>
    events(String event, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
    Creates Watch to monitoring the custom user events.
    io.vertx.ext.consul.Watch<T>
    Get the delegate instance.
    int
     
    static Watch<io.vertx.ext.consul.KeyValue>
    key(String key, Vertx vertx)
    Creates Watch to monitoring a specific key in the KV store.
    static Watch<io.vertx.ext.consul.KeyValue>
    key(String key, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
    Creates Watch to monitoring a specific key in the KV store.
    static Watch<io.vertx.ext.consul.KeyValueList>
    keyPrefix(String keyPrefix, Vertx vertx)
    Creates Watch to monitoring a prefix of keys in the KV store.
    static Watch<io.vertx.ext.consul.KeyValueList>
    keyPrefix(String keyPrefix, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
    Creates Watch to monitoring a prefix of keys in the KV store.
    static <T> Watch<T>
    newInstance(io.vertx.ext.consul.Watch<T> delegate)
    Creates a new instance of the Watch.
    static <T> Watch<T>
    newInstance(io.vertx.ext.consul.Watch<T> delegate, TypeArg<T> typeArg_0)
    Creates a new instance of the Watch.
    static Watch<io.vertx.ext.consul.CheckList>
    nodeHealthChecks(String node, io.vertx.ext.consul.CheckQueryOptions opt, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
    Creates Watch to monitoring the health checks of the nodes.
    static Watch<io.vertx.ext.consul.NodeList>
    nodes(Vertx vertx)
    Creates Watch to monitoring the list of available nodes.
    static Watch<io.vertx.ext.consul.NodeList>
    nodes(Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
    Creates Watch to monitoring the list of available nodes.
    static Watch<io.vertx.ext.consul.ServiceEntryList>
    service(String service, Vertx vertx)
    Creates Watch to monitoring the nodes providing the service.
    static Watch<io.vertx.ext.consul.ServiceEntryList>
    service(String service, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
    Creates Watch to monitoring the nodes providing the service.
    static Watch<io.vertx.ext.consul.CheckList>
    serviceHealthChecks(String service, io.vertx.ext.consul.CheckQueryOptions checkQueryOptions, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
    Creates Watch to monitoring the health checks of the nodes.
    static Watch<io.vertx.ext.consul.ServiceList>
    services(Vertx vertx)
    Creates Watch to monitoring the list of available services.
    static Watch<io.vertx.ext.consul.ServiceList>
    services(Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
    Creates Watch to monitoring the list of available services.
    Set the result handler.
    Start this Watch
    void
    Stop the watch and release its resources
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • __TYPE_ARG

      public static final TypeArg<Watch> __TYPE_ARG
    • __typeArg_0

      public final TypeArg<T> __typeArg_0
  • Constructor Details

    • Watch

      public Watch(io.vertx.ext.consul.Watch<T> delegate)
      Create a new instance of Watch delegating to the given (non-null) instance of Watch.
    • Watch

      public Watch(io.vertx.ext.consul.Watch<T> delegate, TypeArg<T> typeArg_0)
    • Watch

      public Watch(Object delegate, TypeArg<T> typeArg_0)
  • Method Details

    • getDelegate

      public io.vertx.ext.consul.Watch<T> 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
    • key

      public static Watch<io.vertx.ext.consul.KeyValue> key(String key, Vertx vertx)
      Creates Watch to monitoring a specific key in the KV store. The underlying Consul client will be created with default options. This maps to the /v1/kv/ API internally.
      Parameters:
      key - the key
      vertx - the Vertx instance
      Returns:
      the Watch instance
    • key

      public static Watch<io.vertx.ext.consul.KeyValue> key(String key, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
      Creates Watch to monitoring a specific key in the KV store. This maps to the /v1/kv/ API internally.
      Parameters:
      key - the key
      vertx - the Vertx instance
      options - the options to create underlying Consul client
      Returns:
      the Watch instance
    • keyPrefix

      public static Watch<io.vertx.ext.consul.KeyValueList> keyPrefix(String keyPrefix, Vertx vertx)
      Creates Watch to monitoring a prefix of keys in the KV store. The underlying Consul client will be created with default options. This maps to the /v1/kv/ API internally.
      Parameters:
      keyPrefix - the key
      vertx - the Vertx instance
      Returns:
      the Watch instance
    • keyPrefix

      public static Watch<io.vertx.ext.consul.KeyValueList> keyPrefix(String keyPrefix, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
      Creates Watch to monitoring a prefix of keys in the KV store. This maps to the /v1/kv/ API internally.
      Parameters:
      keyPrefix - the key
      vertx - the Vertx instance
      options - the options to create underlying Consul client
      Returns:
      the Watch instance
    • services

      public static Watch<io.vertx.ext.consul.ServiceList> services(Vertx vertx)
      Creates Watch to monitoring the list of available services. The underlying Consul client will be created with default options. This maps to the /v1/catalog/services API internally.
      Parameters:
      vertx - the Vertx instance
      Returns:
      the Watch instance
    • services

      public static Watch<io.vertx.ext.consul.ServiceList> services(Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
      Creates Watch to monitoring the list of available services. This maps to the /v1/catalog/services API internally.
      Parameters:
      vertx - the Vertx instance
      options - the options to create underlying Consul client
      Returns:
      the Watch instance
    • service

      public static Watch<io.vertx.ext.consul.ServiceEntryList> service(String service, Vertx vertx)
      Creates Watch to monitoring the nodes providing the service. Nodes will be sorted by distance from the consul agent. The underlying Consul client will be created with default options. This maps to the /v1/health/service/<service> API internally.
      Parameters:
      service - the service name
      vertx - the Vertx instance
      Returns:
      the Watch instance
    • service

      public static Watch<io.vertx.ext.consul.ServiceEntryList> service(String service, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
      Creates Watch to monitoring the nodes providing the service. Nodes will be sorted by distance from the consul agent. This maps to the /v1/health/service/<service> API internally.
      Parameters:
      service - the service name
      vertx - the Vertx instance
      options - the options to create underlying Consul client
      Returns:
      the Watch instance
    • events

      public static Watch<io.vertx.ext.consul.EventList> events(String event, Vertx vertx)
      Creates Watch to monitoring the custom user events. The underlying Consul client will be created with default options. This maps to the /v1/event/list API internally.
      Parameters:
      event - the event name
      vertx - the Vertx instance
      Returns:
      the Watch instance
    • events

      public static Watch<io.vertx.ext.consul.EventList> events(String event, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
      Creates Watch to monitoring the custom user events. This maps to the /v1/event/list API internally.
      Parameters:
      event - the event name
      vertx - the Vertx instance
      options - the options to create underlying Consul client
      Returns:
      the Watch instance
    • nodes

      public static Watch<io.vertx.ext.consul.NodeList> nodes(Vertx vertx)
      Creates Watch to monitoring the list of available nodes. The underlying Consul client will be created with default options. This maps to the /v1/catalog/nodes API internally.
      Parameters:
      vertx - the Vertx instance
      Returns:
      the Watch instance
    • nodes

      public static Watch<io.vertx.ext.consul.NodeList> nodes(Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
      Creates Watch to monitoring the list of available nodes. This maps to the /v1/catalog/nodes API internally.
      Parameters:
      vertx - the Vertx instance
      options - the options to create underlying Consul client
      Returns:
      the Watch instance
    • nodeHealthChecks

      public static Watch<io.vertx.ext.consul.CheckList> nodeHealthChecks(String node, io.vertx.ext.consul.CheckQueryOptions opt, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
      Creates Watch to monitoring the health checks of the nodes.
      Parameters:
      node - node name or ID
      opt - options like namespace, datacenter and filter
      vertx - the Vertx instance
      options - the options to create underlying Consul client
      Returns:
      the Watch instance
    • serviceHealthChecks

      public static Watch<io.vertx.ext.consul.CheckList> serviceHealthChecks(String service, io.vertx.ext.consul.CheckQueryOptions checkQueryOptions, Vertx vertx, io.vertx.ext.consul.ConsulClientOptions options)
      Creates Watch to monitoring the health checks of the nodes.
      Parameters:
      service - the service name
      checkQueryOptions - options used to request checks
      vertx - the Vertx instance
      options - the options to create underlying Consul client
      Returns:
      the Watch instance
    • setHandler

      public Watch<T> setHandler(Consumer<WatchResult<T>> handler)
      Set the result handler. As data is changed, the handler will be called with the result.
      Parameters:
      handler - the result handler
      Returns:
      reference to this, for fluency
    • start

      public Watch<T> start()
      Start this Watch
      Returns:
      reference to this, for fluency
    • stop

      public void stop()
      Stop the watch and release its resources
    • newInstance

      public static <T> Watch<T> newInstance(io.vertx.ext.consul.Watch<T> delegate)
      Creates a new instance of the Watch.
    • newInstance

      public static <T> Watch<T> newInstance(io.vertx.ext.consul.Watch<T> delegate, TypeArg<T> typeArg_0)
      Creates a new instance of the Watch.
    • 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