Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watcher not work #86

Open
krowkrow opened this issue Jan 18, 2018 · 1 comment
Open

watcher not work #86

krowkrow opened this issue Jan 18, 2018 · 1 comment

Comments

@krowkrow
Copy link

`$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

@Timandes
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants