vertx / io.vertx.ext.consul / Watch

Watch

interface Watch<T : Any>

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

Functions

events

open static fun events(event: String, vertx: Vertx): Watch<EventList>

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.

open static fun events(event: String, vertx: Vertx, options: ConsulClientOptions): Watch<EventList>

Creates Watch to monitoring the custom user events. This maps to the /v1/event/list API internally.

key

open static fun key(key: String, vertx: Vertx): Watch<KeyValue>

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.

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

Creates Watch to monitoring a specific key in the KV store. This maps to the /v1/kv/ API internally.

keyPrefix

open static fun keyPrefix(keyPrefix: String, vertx: Vertx): Watch<KeyValueList>

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.

open static fun keyPrefix(keyPrefix: String, vertx: Vertx, options: ConsulClientOptions): Watch<KeyValueList>

Creates Watch to monitoring a prefix of keys in the KV store. This maps to the /v1/kv/ API internally.

nodes

open static fun nodes(vertx: Vertx): Watch<NodeList>

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.

open static fun nodes(vertx: Vertx, options: ConsulClientOptions): Watch<NodeList>

Creates Watch to monitoring the list of available nodes. This maps to the /v1/catalog/nodes API internally.

service

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

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.

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

Creates Watch to monitoring the nodes providing the service. This maps to the /v1/health/service/<service> API internally.

services

open static fun services(vertx: Vertx): Watch<ServiceList>

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.

open static fun services(vertx: Vertx, options: ConsulClientOptions): Watch<ServiceList>

Creates Watch to monitoring the list of available services. This maps to the /v1/catalog/services API internally.

setHandler

abstract fun setHandler(handler: Handler<WatchResult<T>>): Watch<T>

Set the result handler. As data is changed, the handler will be called with the result.

start

abstract fun start(): Watch<T>

Start this Watch

stop

abstract fun stop(): Unit

Stop the watch and release its resources