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

Detecting Table status change #237

Closed
gm42 opened this issue Mar 19, 2020 · 2 comments
Closed

Detecting Table status change #237

gm42 opened this issue Mar 19, 2020 · 2 comments

Comments

@gm42
Copy link

gm42 commented Mar 19, 2020

I am looking for a way to detect that a table status has changed (let's say from PartitionRecovering/PartitionPreparing to PartitionRunning).

How would you suggest to implement this? Aside from polling, is there an approach which can make intelligent use of the callbacks? Or perhaps we need a status change callback in goka?

@frairon
Copy link
Contributor

frairon commented Mar 22, 2020

Hi gm42, as announced in issue #239 there will be a refactored version of goka.

In this new version we use a "Signal" which allows to check for a state with polling as well as block/wait until the signal is in a certain state.
This can be used to achieve what you need. The view implementation e.g. already provides a function for that: func (v *View) WaitRunning() <-chan struct{}
The channel will be closed as soon as the view is in state Running.
For the processor we currently only have func (g *Processor) Recovered() bool, but we can easily add the blocking version.

So my suggestion is that you try branch consumer-group or vendor tag v0.9.0-beta2 and let me know if you if such a function would be useful for your purposes. Or create a PR on that branch :)
Cheers

@frairon
Copy link
Contributor

frairon commented Oct 10, 2020

Closing this for no activity, also it is currently more or less supported via the View's ObserveStateChanges method, that passes the underlying partition table state.

@frairon frairon closed this as completed Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants