Skip to main content
Sometimes, it is useful to break processor functions into small pieces that will be processed depending on the previous executed step. One way to handle this kind of logic is by using switch statements.

Basic Step Pattern

By saving the next step value every time we complete the previous step (here, saving it in the job’s data), we can ensure that if the job errors and retries, it does so starting from the correct step.

Delaying Between Steps

You can delay a job between steps using the moveToDelayed method:

Waiting for Children

A common use case is to add children at runtime and then wait for the children to complete:

Chaining Flows

Another use case is to add flows at runtime and then wait for the children to complete:
Manually moving jobs using special errors does not increment the attemptsMade property. This property is incremented on regular job completion or failure (this includes retries using a backoff strategy). To control how many times a job is allowed to start processing, use the maxStartedAttempts option.

Flows

Learn about parent-child job dependencies

Job Data

Updating job data during processing

Move To Delayed

API reference for moveToDelayed

Move To Waiting Children

API reference for moveToWaitingChildren