Task-based API.
Task-based API. Works just like withDefault
except it loads configuration from
specified resource.
Example usage:
import knobs._
ZooKeeper.fromResource(List(Required(ClassPathResource("speech-service.conf")))) { r => for {
cfg <- load(Required(r))
// Application code here
} yield () }.run
Unsafe API.
Unsafe API. Loads the standard config, just like withDefault
,
except this returns the resource together with a Task
that you can
run
to close the Zookeeper connection at the end of your application.
Example usage:
import knobs._
val (r, close) = ZooKeeper.unsafeDefault
// Application code here
close.run
Unsafe API.
Unsafe API. Works just like unsafeDefault
except it loads configuration from
specified resource
Example usage:
import knobs._
val (r, close) = ZooKeeper.unsafeFromResource(List(Required(ClassPathResource("my-service.conf"))))
// Application code here
close.run
A process that produces an event when the given path's data changes.
A process that produces an event when the given path's data changes.
This process only contains a single event.
To subscribe to multiple events, call repeat
on the result of this method.
With only one event, we prevent multiple reloads occurring simultaneously
in Watched
znodes.
Task-based API.
Task-based API. Loads the standard configuration from /usr/share/oncue/etc/zookeeper.cfg or, failing that, from the classpath at oncue/zookeeper.cfg.
Expects zookeeper.connectionString
to be defined in that cfg file,
which is a string of the form "hostname:port".
Expects zookeeper.pathToConfig
to be defined as well, which is the
zookeeper path to the ZNode that contains the configuration.
Manages the lifecycle of the ZooKeeper connection for you.
Usage example:
import knobs._
ZooKeeper.withDefault { r => for {
cfg <- load(Required(r))
// Application code here
} yield () }.run