Each W can register themselves as a ephemeral node, such as /alive/w1,/alive/w2…. Then put a watcher on the /alive path, the watcher will be called back when the w(i) disappear because of the w(i) down. You also need handle the connection loss cases and other details.
> 在 2017年4月19日,下午8:59,Tejash Tarun <[email protected]> 写道: > > Hi, > > How to use curator framework to achieve the following: > > I have one instance of ResourceManager RM running which provides work to 5 > Workers W[1...5]. RM and Ws are java applications. > > Zookeeper is being used for service discovery and coordination of Ws. > > Now, how to have a callback in RM if any of W goes down ? > Basically, Zookeeper via heartbeat via session of W can detect the aliveness > of W, however when W goes down Zookeeper knows this due to absence of the > heartbeat. > > But how to get a callback in RM for the event ? > > Any suggestion and help is appreciated. > > Thanks !!
