When using ZooKeeper is it possible to watch for all events on descendant znodes?
for example if I have:
(/)
/ \
(/a) (/b)
/ \
(/c) (/d)
Is there a way to watch the root for changes to /a, /b, /c and /d ?
There is no ZooKeeper api to do that, you will have to write your own.
If you are using Curator, you can use PathCache which maintains watches on a node, and that node's children. You can write some code to create more PathCaches as you discover descendants of the root you are watching.
If you are going to roll your own version of this, it is actually quite tricky to get right. This blog describes some of the problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With