php-zookeeper
php-zookeeper copied to clipboard
watcher not work
`$zk->get('/test', 'mywatch');
function mywatch($eventType, $eventState, $eventKey) { echo 'listen node'; print_r(func_get_args()); } `
i add node /test/a, or remove it, mywatch function not work,
PHP7.0.24 NTS
According to ZooKeeper Programmer's Guide[1],
getData() and exists() set data watches. getChildren() sets child watches
So,
A successful create() will trigger a data watch for the znode being created and a child watch for the parent znode. A successful delete() will trigger both a data watch and a child watch (since there can be no more children) for a znode being deleted as well as a child watch for the parent znode.
[1] http://zookeeper.apache.org/doc/r3.5.3-beta/zookeeperProgrammers.html#ch_zkWatches