Pattern for aggregating data into a unique job during a scheduled window #1201
Unanswered
glerchundi
asked this question in
Q&A
Replies: 1 comment
-
Nah afraid not. That insert operation as a
Yeah, that's the approach I would've recommend after reading the first couple paragraphs of your post. Get different data into a different table and reference that as jobs work.
Nope, I think this should work out reasonably well. Just make sure to do the insert of the job row and your extra row in the same transaction. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! First of all, great project. I just discovered it and I really liked the approach.
Please correct me if some of my assumptions are incorrect! Also, is there any other channel for asking these kind of questions? I see no discord, slack, or any other comm. channel in the repo
River unique jobs +
scheduled_atpattern is exactly the foundation we need for our event processing system.Use case
We have a CDC pipeline (outbox -> Pub/Sub -> processors) where multiple events can arrive for the same entity in quick succession. We want to collect all events that arrive within a fixed window and process them together in a single job.
What we'll be doing
We’re using unique jobs with
ByPeriod+ScheduledAtto ensure only one job exists per entity during the collection window. That part works perfectly.The problem is attaching the event data. When the second event arrives and the insert returns
UniqueSkippedAsDuplicate, the new event’s args are discarded. We need that data.Our current workaround is an associated table:
When the worker picks up the job, it joins against
job_eventsto get all collected events.My question:
Is there a recommended pattern within River for this kind of event aggregation? Specifically:
Happy to share more context on our architecture if helpful. Thanks!
(P.D. written in the GitHub mobile app, sorry for the formatting!)
Beta Was this translation helpful? Give feedback.
All reactions