Skip to main content
BullMQ’s flow system is built on parent-child dependencies. Understanding how these dependencies work is crucial for building complex workflows.

How Dependencies Work

In BullMQ flows, a parent job will not be processed until all of its children have completed successfully. This creates a dependency tree where:
  • Children are processed first
  • Parents wait in the “waiting-children” state
  • Parent processing begins only after all children complete

Dependency States

Jobs in a flow can have dependencies in different states:

Processed

Children that have completed successfully

Unprocessed

Children that are waiting or in progress

Failed

Children that have failed during processing

Ignored

Failed children that are ignored by parent

Managing Dependencies

Get Dependencies

Retrieve all dependencies of a parent job:
Get specific types of dependencies with pagination:

Get Dependencies Count

Get counts of dependencies by state:
Or retrieve specific counts:

Get Children Values

Access the return values from all child jobs:

Parent Options

When creating child jobs, you can specify how they relate to their parent:
Children automatically inherit the parent relationship:

Accessing Parent Information

Child jobs have access to their parent information:

Checking Parent State

Parent jobs waiting for children have a special state:

Complex Dependency Patterns

Serial Execution

Create a chain where jobs execute one after another:

Parallel Execution with Aggregation

Process multiple children in parallel, then aggregate results:

Mixed Serial and Parallel

Combine serial and parallel execution patterns:

Dependency Failure Handling

By default, if any child fails, the parent will not be processed. However, you can customize this behavior:

Remove Dependency

Remove failed child from parent dependencies

Ignore Dependency

Ignore failed child but keep dependency

Fail Parent

Make parent fail when child fails

Continue Parent

Process parent immediately on child failure

Example: Multi-Stage Processing

Here’s a complete example of a multi-stage data processing workflow:

API Reference