Skip to main content

Synchronous execution

runSync() drives the entire workflow in-process, using the same single replay loop as the queued path. It is handy for tests, tinkering, and short workflows that don't need to suspend:

$run = SagaFlow::create(CheckoutWorkflow::class)
->withArguments('order-42')
->runSync();

$run->status; // FlowStatus::Completed
$run->result; // the array handle() returned

The queued and synchronous paths are guaranteed to reach the same final database state — the only difference is who drives the steps (your worker vs. the current process).

When to use which

run() (queued)runSync()
Returnsa Pending FlowRun immediatelya settled FlowRun
Drives stepson your queue workersin the calling process
Suspend/resumeyes (signals, queued actions)resolved inline where possible
Good forproduction, long-running flowstests, short flows, exploration
note

A workflow that awaits a signal cannot make progress under runSync() past the wait unless the signal was already delivered — synchronous execution has no worker to resume it later. Model long-running, human-in-the-loop flows with the queued path.