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

Callback for kvWatcher #676

Closed
Kazmirchuk opened this issue Aug 14, 2023 · 1 comment
Closed

Callback for kvWatcher #676

Kazmirchuk opened this issue Aug 14, 2023 · 1 comment
Labels

Comments

@Kazmirchuk
Copy link

Can I use a callback to watch for KV updates? Just like a normal NATS subscription.

Looking at the docs, it seems like currently my only option is to create a separate thread and call kvWatcher_Next in a loop, which is far from optimal =\

@kozlovic
Copy link
Member

No, there is no callback for a KV watcher. You have indeed to call Next in a loop. One could imagine a new kvWatchOptions that would be a callback that is invoked with each new entry. But note that even the Go client returns an object on which the user can call Updates() which is a Go channel to receive those updates. So there is no such callback in the Go client either.

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

No branches or pull requests

2 participants