bullmq icon indicating copy to clipboard operation
bullmq copied to clipboard

Branching during Flow execution

Open vicpara opened this issue 6 months ago • 1 comments

I am interested in knowing if this type of flow execution is possible. This is not necessarily a feature request. I'm using BullMQ with NodeJS.

In a given flow, the parent-children dependency tree is given at flow creation time.

Let's say that during the execution of a child task there is a boolean result 'answer'. There are two chained strands of tasks that depend on this child task result 'answer'. Is it possible to run one branch and ignore the other depending on 'answer' value? Say for 'true' run one branch and for 'false' run the other?

Currently I'm designing a mechanism that relies on failing the first child of the non-executable branch and using 'ignoreDependencyOnFailure' when the branch results merge back together. I was wondering if there are other primitives or if there's a more idiomatic way of achieving this.

vicpara avatar Feb 20 '24 14:02 vicpara