Is it possible to specify a single children for more jobs using FlowProducer? #3005
paologf-mb
started this conversation in
General
Replies: 1 comment
-
What you are proposing is not possible, as one job cannot have more than 1 parent, however I am not sure why need this. In any case you could have a chassisJob that as last step in its processor function what it does is create a new Flow, something like this: import { FlowProducer } from 'bullmq';
const flowProducer = new FlowProducer();
const queueName = 'assembly-line';
// Define a job that should be trigger just one time
const chassisJob = new FlowJob({
name: 'car_chassis',
queueName: 'chassis',
data: { }, // Some data
})
const chassisQueue = new Queue('chassis', ...);
const chassisWorker = new Worker('chassis', async (job) => {
// Do something
const chain = await flowProducer.add({
name: 'car_engine',
data: { }, // Some data
queueName: 'engine',
children: [
{
name: 'car_wheel_1',
queueName: 'wheels',
data: { }, // Some data
},
{
name: 'car_wheel_2',
queueName: 'wheels',
data: { }, // Some data
},
{
name: 'car_wheel_3',
queueName: 'wheels',
data: { }, // Some data
},
{
name: 'car_wheel_4',
queueName: 'wheels',
data: { }, // Some data
}],
});
})
}); |
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
-
Hello, using FlowProducer is it possible to specify a single children for more jobs?
For example (taking from the doc) instead of having this:
, split the "wheels" step in 4 "wheel" steps that should start only after the "chassis" step and trigger the "engine" step.
So make chassis -> mount each wheel (separately but in parallel) -> add engine.
Something like this pseudo-code:
, where is important that the chassisJob is launched only once and trigger each "wheels" queue.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions