zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timrc_us <timrc...@yahoo.com>
Subject Re: Multiple watches in queue
Date Fri, 22 Dec 2017 20:44:31 GMT
Hi Prasanna-

I can't speak to the javascript/node bindings, but in other languages, 
you call a single function that
both gets the current value *and* sets a watch simultaneously.
For example, in the c bindings, there's zoo_wget() :
which gets the current value in the node *and* sets a new watch for 
changes to it, atomically.
Similarly, there is zoo_wexists() and zoo_wgetchildren().

You may not get a notification for every individual change of the node 
(e.g. if the node changes after a
watch notice was sent back to you, but before you read the value and set 
a new watch).
However, you will get a watch notice sent back to you every time the 
node value is different from what
you last read. That is sufficient for most of the synchronization 
primitives folks need to make.

If you really need to know about every individual change (vs just making 
sure you're up-to-date),
then you'd probably have to do something like make each change a 
(sequential) child node and
have the watcher process delete them as they are handled.



Prasanna koirala wrote:
> Here is my problem
> https://stackoverflow.com/questions/47924402/is-there-a-way-to-add-watcher-queue-in-zookeeper
> Is there any solution to it ?? Any kind of research or work in progress ?

View raw message