curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McKenzie <mckenzie....@gmail.com>
Subject Re: How to use Curator for Watching the nodes and trigger purpose
Date Fri, 08 Nov 2013 20:31:45 GMT
client.getCuratorListenable().addListener(new CuratorListener() {
    public void eventReceived(CuratorFramework curator, CuratorEvent event)
{
        //Your event handling code here.
    }
});

client.getChildren().watched().forPath("/bla");

Note the 'watched()' call.

This will return you all children currently under the path, and you will
receive a watch event whenever children are added or removed from the
parent node. Remember that you need to rewatch the parent node after each
event.




On Sat, Nov 9, 2013 at 7:17 AM, Techy Teck <comptechgeeky@gmail.com> wrote:

> I recently started working with Zookeeper and I am using Curator library
> for this. I am able to create all kind of nodes and delete nodes as well.
>
> Now I started working on Watches but I am not able to get any simple
> example how to use Curator library to do watches on any parent nodes and if
> any new child nodes get added to these parent nodes, watches should get
> triggered and perform some activity then.
>
> Is there any simple example that I can see on how watches works using
> Curator library? Any github link will also be great. Thanks.
>

Mime
View raw message