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 <[email protected]> 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.
>