Skip to content
NewJoobQ SDKs updated to v0.8.0.Build your first workflow

Workflows · JoobQ Pro

Durable workflows that replay, not just retry.

A workflow is a declared graph of steps. Every state change is an event appended to its history in Redis by one Lua script, so a crashed worker loses nothing Redis kept. Crystal workflows run on the engine directly; workflows written with the SDKs are conducted by the same engine on the server, which sends each step to a worker as its own leased task.

Fire-and-forget job

JoobQ · OSS
  1. enqueue
  2. perform
  3. retry · backoff
  4. dead letter

A job is one unit of work: it is retried with randomized exponential backoff, then kept in the dead-letter set with its error. Undoing what earlier jobs already did is left to your code.

Durable workflow

JoobQ Pro
  1. reserve
  2. charge
  3. release

A workflow is a declared graph whose state is a fold of an append-only history in Redis. The engine decides every step, so a crashed worker loses nothing Redis kept.

  • Saga compensation on failureA step that fails for good runs the compensations of the completed steps, newest first; then the run is failed.
  • Signals with timeoutswait_for parks the run without holding a worker; with no signal in time the engine records StepTimedOut.
  • Deterministic replayreplay(history, definition) re-decides a recorded history against new code and reports the first divergence.
Read the workflow guide

Simulate execution

runconf-signal-python-7d2econf-signal-pythonpending
  1. step before
    step · activitypending
  2. wait_for approval
    wait_for signal: "approve" · 60 spending
  3. step after
    input: steps.approval.output.bypending

The run parks on wait_for "approval" without holding a worker, until an operator sends the approve signal.

Event history

  1. No events yet. Press Simulate execution.

Audit log preview

append-only
Audit rows written by the simulated calls, newest first
Rows appear when an operator calls the API: the signal, a re-drive.

A deterministic replay of the conformance workflows, in your browser. Nothing is sent anywhere.

See it work

A workflow in your language, and its run in the console.

Each sample is a workflow as the conformance workers declare it, in 10 languages: the suite starts it against a real server and checks its history. Screenshots are the JoobQUI console with sample data.

Crystal declares a workflow with the JoobQ Pro DSL and runs it on the engine. An SDK declares a blueprint; the server’s engine conducts it and sends each step to a worker as its own task. Both need a JoobQ Pro key.

Steps

Declare the steps, and what flows between them

A step names its handler and takes its input from the run’s input or from an earlier step’s output. The engine runs a step when the steps it reads have completed, and the Workflows page lists every run with its status, search attributes and progress.

worker.cr · wf-stepsJoobQ Pro
workflow "conf-steps-#{LANG}" do
  step "a", StepA, input: {x: input(:x)}
  step "b", StepB, input: {v: ref("steps.a.output.doubled")}
end,

Two steps: the second reads the first one’s output.

The console’s Workflows page, Runs tab: a table of runs with status, workflow name, id, search attributes, a progress bar, start time and duration.The console’s Workflows page, Runs tab: a table of runs with status, workflow name, id, search attributes, a progress bar, start time and duration.
Workflows page: every run, filtered by status, build or attribute. JoobQUI console, sample data.

Fan out and join

Run steps side by side, then join

A parallel group starts its steps together; the step after it waits for all of them and reads each one’s output. A run’s Graph tab draws the steps and their dependencies with the state each is in.

worker.cr · wf-parallelJoobQ Pro
workflow "conf-parallel-#{LANG}" do
  parallel do
    step "p1", One
    step "p2", Two
  end
  step "join", Join, input: {a: ref("steps.p1.output.v"), b: ref("steps.p2.output.v")}
end,

Two steps in parallel, then a step that reads both outputs.

A workflow run in the console, Graph tab: three extract steps completed in parallel, a transform step running, and two later steps pending.A workflow run in the console, Graph tab: three extract steps completed in parallel, a transform step running, and two later steps pending.
A run’s graph: completed, running and pending steps. JoobQUI console, sample data.

Signals and timers

Wait for a person, or for the clock

A wait_for step parks the run until a signal arrives or its timeout passes, and the signal’s payload is its output; a timer step waits a set time. Nothing holds a worker meanwhile. From a run’s page an operator sends the signal, queries the run, cancels or replays it.

worker.cr · wf-signal · worker.cr · wf-timerJoobQ Pro
workflow "conf-signal-#{LANG}" do
  step "before", Ok
  wait_for "approval", signal: "approve", timeout: 60.seconds
  step "after", Approved, input: {by: ref("steps.approval.output.by")}
end,
workflow "conf-timer-#{LANG}" do
  timer "pause", for: 3.seconds
  step "after", Now
end,

A step, a wait for the signal approve (60 seconds at most), then a step that reads who approved; and a three-second timer.

A workflow run’s page in the console: buttons to Signal, Query, Cancel, Terminate, Continue as new, Replay, Migrate and Send update, its search attributes, and the Timeline tab with one bar per step.A workflow run’s page in the console: buttons to Signal, Query, Cancel, Terminate, Continue as new, Replay, Migrate and Send update, its search attributes, and the Timeline tab with one bar per step.
A run’s page: its actions, and the timeline of its steps. JoobQUI console, sample data.

Sagas

Undo what was done when a later step fails

A step can name a compensation. When a later step fails for good, the engine runs the compensations of the completed steps, newest first. Every scheduling, start, completion, failure and compensation is an event in the run’s history, which the History tab lists with its payloads.

worker.cr · wf-sagaJoobQ Pro
workflow "conf-saga-#{LANG}" do
  step "reserve", Reserve, input: {probe: input(:probe)}, compensate: compensation(Release, input: ref("steps.reserve.output.reservation"))
  step "charge", Charge
end,

Reserve, then charge; the reservation is released if the charge fails.

A workflow run in the console, History tab: twelve numbered events (Workflow Started, Step Scheduled, Step Started, Step Completed) with their step, time and a Payload link.A workflow run in the console, History tab: twelve numbered events (Workflow Started, Step Scheduled, Step Started, Step Completed) with their step, time and a Payload link.
A run’s history: one row per event, with its payload. JoobQUI console, sample data.
Tour the whole console