curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Blum <dragonsi...@gmail.com>
Subject Re: TreeCache not working
Date Thu, 31 Mar 2016 20:56:00 GMT
I took a cursory look but I've never used Scala.  Nothing seems obviously
wrong, so I'm not sure what to say?  I'm pretty sure TreeCache generally
works as intended.

On Thu, Mar 31, 2016 at 4:06 PM, Jordan Zimmerman <
jordan@jordanzimmerman.com> wrote:

> Scott, please have a look.
>
> On Mar 31, 2016, at 12:29 PM, Sakthipriyan Vairamani <
> sakthiprofessional@gmail.com> wrote:
>
> I am using Apache Curator Recipes v2.10.0, with Scala 2.11.8. I want to be notified whenever
there is a change (addition, deletion, and updation) in the Node I am watching. Following
is the code I have,
>
>     curatorClient = CuratorFrameworkFactory.newClient("proper Connection String"),
>       new ExponentialBackoffRetry(1000, 3))
>     curatorClient.start()
>
>     treeCache = new TreeCache(curatorClient, "/a")
>     treeCache.start()
>
>     treeCache.getListenable.addListener(new TreeCacheListener {
>       override def childEvent(client: CuratorFramework, event: TreeCacheEvent): Unit
= {
>
>         event.getType match {
>           case TreeCacheEvent.Type.NODE_ADDED => ERROR("TreeNode added: "
>             + ZKPaths.getNodeFromPath(event.getData.getPath) + ", value: "
>             + new String(event.getData.getData))
>           case TreeCacheEvent.Type.NODE_UPDATED => ERROR("TreeNode Updated: "
>             + ZKPaths.getNodeFromPath(event.getData.getPath) + ", value: "
>             + new String(event.getData.getData))
>           case TreeCacheEvent.Type.NODE_REMOVED => ERROR("TreeNode Removed: "
>             + ZKPaths.getNodeFromPath(event.getData.getPath) + ", value: "
>             + new String(event.getData.getData));
>           case ex: TreeCacheEvent.Type => ERROR(s"Received Event [$ex]")
>         }
>
>       }
>     })
>
> Now, the only message I get from this is
>
>     Received Event [INITIALIZED]
>
> Nothing else. I tried adding nodes to /a through zkCli and also through the program (I
use util-zk library for inserting). What am I missing?
>
>
>

Mime
View raw message