Watch

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 <code>Handler</code> with <code>AsyncResult</code> is invoked.

As an example, you could watch the status of health checks and notify when a check is critical.

package

Default

Methods

__construct

__construct() 

Creates <code>Watch</code> to monitoring the custom user events.

events( $arg0,  $arg1,  $arg2 = null) : \io\vertx\jphp\ext\consul\Watch<EventList>
static

The underlying Consul client will be created with default options. This maps to the /v1/event/list API internally.

param $event [string] the event name param $vertx [Vertx] the {@code Vertx} instance events($event, $vertx)

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

param $event [string] the event name param $vertx [Vertx] the {@code Vertx} instance param $options [ConsulClientOptions | array] the options to create underlying Consul client events($event, $vertx, $options)

Arguments

$arg0

string

$arg1

Vertx

$arg2

array | ConsulClientOptions

Response

\io\vertx\jphp\ext\consul\Watch

the {@code Watch} instance

Creates <code>Watch</code> to monitoring a specific key in the KV store.

key( $arg0,  $arg1,  $arg2 = null) : \io\vertx\jphp\ext\consul\Watch<KeyValue>
static

The underlying Consul client will be created with default options. This maps to the /v1/kv/ API internally.

param $key [string] the key param $vertx [Vertx] the {@code Vertx} instance key($key, $vertx)

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

param $key [string] the key param $vertx [Vertx] the {@code Vertx} instance param $options [ConsulClientOptions | array] the options to create underlying Consul client key($key, $vertx, $options)

Arguments

$arg0

string

$arg1

Vertx

$arg2

array | ConsulClientOptions

Response

\io\vertx\jphp\ext\consul\Watch

the {@code Watch} instance

Creates <code>Watch</code> to monitoring a prefix of keys in the KV store.

keyPrefix( $arg0,  $arg1,  $arg2 = null) : \io\vertx\jphp\ext\consul\Watch<KeyValueList>
static

The underlying Consul client will be created with default options. This maps to the /v1/kv/ API internally.

param $keyPrefix [string] the key param $vertx [Vertx] the {@code Vertx} instance keyPrefix($keyPrefix, $vertx)

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

param $keyPrefix [string] the key param $vertx [Vertx] the {@code Vertx} instance param $options [ConsulClientOptions | array] the options to create underlying Consul client keyPrefix($keyPrefix, $vertx, $options)

Arguments

$arg0

string

$arg1

Vertx

$arg2

array | ConsulClientOptions

Response

\io\vertx\jphp\ext\consul\Watch

the {@code Watch} instance

Creates <code>Watch</code> to monitoring the list of available nodes.

nodes( $arg0,  $arg1 = null) : \io\vertx\jphp\ext\consul\Watch<NodeList>
static

The underlying Consul client will be created with default options. This maps to the /v1/catalog/nodes API internally.

param $vertx [Vertx] the {@code Vertx} instance nodes($vertx)

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

param $vertx [Vertx] the {@code Vertx} instance param $options [ConsulClientOptions | array] the options to create underlying Consul client nodes($vertx, $options)

Arguments

$arg0

Vertx

$arg1

array | ConsulClientOptions

Response

\io\vertx\jphp\ext\consul\Watch

the {@code Watch} instance

Creates <code>Watch</code> to monitoring the nodes providing the service.

service( $arg0,  $arg1,  $arg2 = null) : \io\vertx\jphp\ext\consul\Watch<ServiceEntryList>
static

The underlying Consul client will be created with default options. This maps to the /v1/health/service/<service> API internally.

param $service [string] the service name param $vertx [Vertx] the {@code Vertx} instance service($service, $vertx)

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

param $service [string] the service name param $vertx [Vertx] the {@code Vertx} instance param $options [ConsulClientOptions | array] the options to create underlying Consul client service($service, $vertx, $options)

Arguments

$arg0

string

$arg1

Vertx

$arg2

array | ConsulClientOptions

Response

\io\vertx\jphp\ext\consul\Watch

the {@code Watch} instance

Creates <code>Watch</code> to monitoring the list of available services.

services( $arg0,  $arg1 = null) : \io\vertx\jphp\ext\consul\Watch<ServiceList>
static

The underlying Consul client will be created with default options. This maps to the /v1/catalog/services API internally.

param $vertx [Vertx] the {@code Vertx} instance services($vertx)

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

param $vertx [Vertx] the {@code Vertx} instance param $options [ConsulClientOptions | array] the options to create underlying Consul client services($vertx, $options)

Arguments

$arg0

Vertx

$arg1

array | ConsulClientOptions

Response

\io\vertx\jphp\ext\consul\Watch

the {@code Watch} instance

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

setHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

reference to this, for fluency

Start this <code>Watch</code>

start() : $this

Response

$this

reference to this, for fluency

Stop the watch and release its resources

stop() : void