Skip to main content

Overview

FlowJob defines a job that can have child dependencies, creating a tree-like structure where children are processed before their parents.

Interface

Properties

name

name
string
required
The name of the job

queueName

queueName
string
required
The name of the queue where this job will be added

data

data
any
The payload data for this job

prefix

prefix
string
Custom prefix for this job’s queue (overrides default)

opts

opts
JobsOptions
Job options (excluding debounce, deduplication, and repeat for parent jobs)

children

children
FlowJob[]
Array of child jobs that must complete before this job can be processed

Examples

Simple Flow

Nested Flow

Cross-Queue Flow

With Job Options

Multiple Independent Parents

Flow Execution

Processing Order

  1. All child jobs are added to their respective queues
  2. The parent job is added in waiting-children state
  3. Workers process the child jobs
  4. When all children complete, the parent moves to waiting state
  5. The parent job is processed
  6. The parent can access children’s results

Accessing Child Results

In the parent job processor:

FlowChildJob

For child jobs, a more restrictive type is used:
Child jobs cannot have:
  • parent option (automatically set)
  • repeat option
  • debounce/deduplication option