io.vertx.ext.consul

## Interface Watch<T>

-     public interface Watch<T>

  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 `AsyncResult` is invoked. As an example, you could watch the status of health checks and notify when a check is critical.
  Author:
    Ruslan Sennov

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Watch<KeyValue>` | `key(String key, Vertx vertx)` Creates `Watch` to monitoring a specific key in the KV store.
    `static Watch<KeyValue>` | `key(String key, Vertx vertx, ConsulClientOptions options)` Creates `Watch` to monitoring a specific key in the KV store.
    `static Watch<ServiceEntryList>` | `service(String service, Vertx vertx)` Creates `Watch` to monitoring the nodes providing the service.
    `static Watch<ServiceEntryList>` | `service(String service, Vertx vertx, ConsulClientOptions options)` Creates `Watch` to monitoring the nodes providing the service.
    `static Watch<ServiceList>` | `services(Vertx vertx)` Creates `Watch` to monitoring the list of available services.
    `static Watch<ServiceList>` | `services(Vertx vertx, ConsulClientOptions options)` Creates `Watch` to monitoring the list of available services.
    `Watch<T>` | `setHandler(Handler<AsyncResult<T>> handler)` Set the result handler.
    `Watch<T>` | `start()` Start this `Watch`
    `void` | `stop()` Stop the watch and release its resources

- - ### Method Detail

    - #### key

          static Watch<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/<key> API internally.
      Parameters:
        `key` - the key
        `vertx` - the `Vertx` instance
      Returns:
        the `Watch` instance

    - #### key

          static Watch<KeyValue> key(String key,
                                     Vertx vertx,
                                     ConsulClientOptions options)

      Creates `Watch` to monitoring a specific key in the KV store. This maps to the /v1/kv/<key> API internally.
      Parameters:
        `key` - the key
        `vertx` - the `Vertx` instance
        `options` - the options to create underlying Consul client
      Returns:
        the `Watch` instance

    - #### services

          static Watch<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

          static Watch<ServiceList> services(Vertx vertx,
                                             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

          static Watch<ServiceEntryList> service(String service,
                                                 Vertx vertx)

      Creates `Watch` to monitoring the nodes providing the service. 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

          static Watch<ServiceEntryList> service(String service,
                                                 Vertx vertx,
                                                 ConsulClientOptions options)

      Creates `Watch` to monitoring the nodes providing the service. 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

    - #### setHandler

          Watch<T> setHandler(Handler<AsyncResult<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

          Watch<T> start()

      Start this `Watch`
      Returns:
        reference to this, for fluency

    - #### stop

          void stop()

      Stop the watch and release its resources

Copyright © 2017. All rights reserved.