Skip to main content

enqueue_workflow_run

Function enqueue_workflow_run 

Source
pub async fn enqueue_workflow_run(
    pool: &DbPool,
    payload: &WorkflowRunEnqueue<'_>,
) -> Result<WorkflowRunDbRecord>
Expand description

Enqueues a workflow run in its own transaction.

Use this API for multi-step work with dependencies, fan-out/fan-in, external gates, cancellation as one logical run, or workflow-level idempotency. Build the payload with WorkflowRunEnqueueBuilder and WorkflowStepEnqueueBuilder.

Calls without an idempotency key always create a new workflow run. Calls with an idempotency key return the existing run only when the canonical enqueue request snapshot matches. Keyed rows without snapshots are rejected by the idempotency cutover.