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

How to modify value in Group table? #423

Open
korrawit opened this issue May 17, 2023 · 4 comments
Open

How to modify value in Group table? #423

korrawit opened this issue May 17, 2023 · 4 comments

Comments

@korrawit
Copy link

korrawit commented May 17, 2023

Hello,

I have a use case where sometimes the value in the Group table is not the correct value and would like to correct it.

Is there any way that Goka allows to modify the value in the Group table outside Goka context?

Thanks,

@frairon
Copy link
Contributor

frairon commented May 22, 2023

Hi Korrawit,

there are two ways to update a table value of a goka processor:

  • add an input edge to the group graph, which consumes a new message that can be used to "correct" the value
  • implement a "Visitor", that is used to iterate over all values.

The first one is used if only individual key-value pairs are to be corrected, so if you know outside the processor which values are broken.
The second option iterates over every key/value pair and calls a callback, so it can be decided whether the value should be updated/repaired or not.

Cheers!

@korrawit
Copy link
Author

Thanks @frairon

One question on the second option

Is that iterating through partitions that are owned by a processor or iterating all partitions in this topic?

@frairon
Copy link
Contributor

frairon commented May 23, 2023

That iteration is done locally only on the partitions owned by the instance of the processor. We use it to schedule jobs at night that clean up the database, so the scheduling will be executed on all processor instances, so all partitions are covered.

An example is here. Documentation is a bit scarce on that.

Out of curiosity, what's your use case?

@korrawit
Copy link
Author

That iteration is done locally only on the partitions owned by the instance of the processor. We use it to schedule jobs at night that clean up the database, so the scheduling will be executed on all processor instances, so all partitions are covered.
An example is here. Documentation is a bit scarce on that.

Interesting! Actually my background, I'm quite new to stream processing technology. My use case is about when something goes wrong in stream processing.. what is the best practice to solve this compared to batch processing we just kind of reprocess data again.

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