Skip to main content

enqueue_workflow_run_tx

Function enqueue_workflow_run_tx 

Source
pub async fn enqueue_workflow_run_tx(
    tx: &mut DbTx<'_>,
    payload: &WorkflowRunEnqueue<'_>,
) -> Result<WorkflowRunDbRecord>
Expand description

Enqueues a workflow run and returns the existing run for an identical keyed retry.

Use this API when composing a workflow enqueue with other database writes in one transaction. For ordinary dependent work, prefer this workflow path over direct-job polling or handler-chained follow-up jobs.

Idempotency is strict for the submitted request snapshot. The snapshot is compared instead of live workflow step rows because steps and dependencies can be legitimately appended or mutated after initial enqueue. Strict workflow idempotency applies to keyed rows with an enqueue_request snapshot; unkeyed rows do not store snapshots, and keyed rows without snapshots are rejected by the idempotency cutover. Job-step stage is part of the canonical initial request after normalizing an omitted stage to Queued; changing the requested initial stage is treated as a different enqueue request.