I am writing a leader election algorithm using zookeeper. I was able to write the leader election part. But I need all the nodes, in a path, to receive events of node addition/removal, to that particular path.
For an example, let's say I have several nodes in /election
. When some other node is added to the same path, or removed from path, I need to receive this event to all the existing nodes in that path. I am able to watch a single node. But how to watch all the nodes in a path.
Furthermore, I need to receive leader changed event to all the nodes too. Is there a way to achieve this?