Watching for changes on specific key in Consul using OrbitzWorld's consul-client
<p>We are in a process of migrating from <a href="https://zookeeper.apache.org/" rel="nofollow noreferrer">Zookeeper</a> to <a href="https://www.consul.io" rel="nofollow noreferrer">Consul</a> for managing dynamic key-value configuration. We are using <a href="https://github.com/OrbitzWorldwide/consul-client" rel="nofollow noreferrer">OrbitzWorldwide client</a> and we would like to use its watch capabilities for subscribing to key-value changes. However, we are not sure how to do this.</p>

<p>Zookeeper has native support for watches. For example:</p>

<pre><code>curator.getData()
    .usingWatcher(watcher)
    .forPath(path);
</code></pre>

<p>In OrbitzWorldwide's client there is the KVCache object which support listeners, but one of the required parameters is <strong>watchSeconds</strong> and it's not clear what happens when timeout reaches? Should we subscribe again?</p>

<p>Sample code using OrbitzWorldwide's client:</p>

<pre><code>KVCache kvCache = KVCache.newCache(consul.keyValueClient(), path, watchSeconds);
kvCache.addListener(new ConsulCache.Listener&lt;String, Value&gt;() {
        public void notify(Map&lt;String, Value&gt; map) {
            // Key changed
        }
});
kvCache.start();
</code></pre>

<p>Is there anyone here with experience in this library that can tell us how we can use it to watch for changes on a key? Can you recommend some other client with better support for watches?</p>