Skip to content

[Question] Add children to Flow at runtime #3403

@gillesgw

Description

@gillesgw

Hello,

I’m trying to solve the following problem:

I receive JSON messages from a Redis stream. The first message corresponds to an initialization job that I must run first. Then, there are a certain number of messages that trigger content generation jobs in the database. These jobs can be executed as they arrive from the stream (it doesn’t matter if some finish before others).

Finally, the last message triggers an “end” job, which must only be executed after all the generation jobs are finished. This “end” job must therefore wait for all the generation jobs created beforehand.

I’m struggling to make this work while using as many of BullMQ’s native features as possible. FlowProducer seems to require knowing all the children in advance… I also tried using the { parent: { id, queue } } option but without success.

What would be the best solution to solve this problem?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions