What is the best approach to create a fork join flow? #1566
fabio-filho
started this conversation in
General
Replies: 1 comment 1 reply
-
@manast, do you know how to solve this? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've built a workflow that creates a sequence of jobs.
A job needs the previous one to be finished to be processed.
There is a model called
fork-join
that would solve my problem.https://en.wikipedia.org/wiki/Fork%E2%80%93join_model
I implemented the workflow using FlowJob to easily connect a job with its dependencies.
https://docs.bullmq.io/guide/flows
My main problem is adding new child jobs dynamically on a pre-existing FlowJob and handling the errors dynamically too without breaking the base workflow.
An example
As I said above, this won't work because I cannot add jobs dynamically. Each "fork" step above only knows the number of child forks after the previous job is completed;
In the current implemented code, each fork step, like above, needs to check every 2 seconds if all its children's jobs were finished;
I need the
failParentOnFailure
on fork children jobs to skip the jobs that need the previous ones to be completed successfully;I tried to implement this workflow using the Process Step Job pattern describe below. The Waiting Children and the Delayed job don't work as expected when the child job got an error and, because of this, the workflow got stuck.
https://docs.bullmq.io/patterns/process-step-jobs
Beta Was this translation helpful? Give feedback.
All reactions