pub struct OutboxRow {Show 13 fields
pub dispatch_key: String,
pub workflow_id: WorkflowId,
pub ordinal: u64,
pub run_id: Option<RunId>,
pub namespace: String,
pub task_queue: String,
pub node: Option<String>,
pub activity_type: String,
pub input: Payload,
pub status: OutboxStatus,
pub attempt: u32,
pub visible_after: DateTime<Utc>,
pub claimed_at: Option<DateTime<Utc>>,
}Expand description
One durable fan-out dispatch staged for a worker.
The row carries everything the out-of-band dispatcher needs to send the activity without
reading workflow history: the originating workflow, the pinned ordinal within its fan-out
range, the derived dispatch_key idempotency guard, the activity type, and the input payload.
attempt, visible_after, claimed_at, and status track retry/backoff and claim state.
claimed_at is set only while a row is OutboxStatus::Claimed; pending and terminal rows
keep it None so stale-claim reconciliation only considers durable claimed rows.
Fields§
§dispatch_key: StringDatabase-level idempotency key, canonically "{workflow_id}:{ordinal}".
workflow_id: WorkflowIdWorkflow that scheduled this fan-out activity.
ordinal: u64Pinned ordinal of this activity within the workflow’s fan-out range.
run_id: Option<RunId>Run that dispatched this ordinal; None for legacy rows (pre-RunId threading). Threaded so a
completion only resolves the run that issued it (continue-as-new safety, OBX-011).
namespace: StringWorkflow’s durable isolation namespace — the correctness boundary the dispatched activity must
route within. Legacy rows (pre-NSTQ-2, persisted before the column existed) read back as the
"default" namespace. Carried on the row so the dispatcher routes via the workflow’s real
namespace instead of inventing the server default (NSTQ-2).
task_queue: StringPool/flavour selector within the namespace. There is no SDK-level task-queue selection yet
(NSTQ-4), so a freshly staged row carries the named "default" task queue; legacy rows
(pre-NSTQ-2) also read back as "default". Carried on the row so the dispatcher routes via the
row’s real selector (NSTQ-2).
node: Option<String>OPTIONAL locality affinity within the (namespace, task_queue) pool. None = no affinity =
any worker in the pool (the genuine current behaviour: there is no SDK-level node selection
yet — NODE-4). Some(node) pins the dispatch to workers advertising that node id. Legacy
rows (pre-NODE-2, persisted before the column existed) read back as None: a NULL column is
“no affinity”, NOT a sentinel string (NODE-2).
activity_type: StringActivity type the worker must execute.
input: PayloadOpaque activity input payload.
status: OutboxStatusLifecycle state of this row.
attempt: u32Zero-based dispatch attempt count; incremented on each retry.
visible_after: DateTime<Utc>Earliest instant at which this row becomes claimable (retry backoff fence).
claimed_at: Option<DateTime<Utc>>Durable instant at which the row was claimed; absent unless status is Claimed.
Implementations§
Source§impl OutboxRow
impl OutboxRow
Sourcepub fn dispatch_key_for(workflow_id: &WorkflowId, ordinal: u64) -> String
pub fn dispatch_key_for(workflow_id: &WorkflowId, ordinal: u64) -> String
Builds the canonical dispatch_key for a (workflow_id, ordinal) pair.
This is the single source of truth for the idempotency key format so the append path and any completion-routing lookups agree byte-for-byte.
Sourcepub fn pending(
workflow_id: WorkflowId,
ordinal: u64,
activity_type: String,
input: Payload,
now: DateTime<Utc>,
) -> Self
pub fn pending( workflow_id: WorkflowId, ordinal: u64, activity_type: String, input: Payload, now: DateTime<Utc>, ) -> Self
Constructs a fresh Pending row for (workflow_id, ordinal) with attempt zero.
visible_after is set to now so the row is immediately claimable. The dispatch_key is
derived via OutboxRow::dispatch_key_for.
Sourcepub fn with_run_id(self, run_id: Option<RunId>) -> Self
pub fn with_run_id(self, run_id: Option<RunId>) -> Self
Sets the dispatching run on this row (the run that owns this ordinal).
Sourcepub fn with_namespace(self, namespace: impl Into<String>) -> Self
pub fn with_namespace(self, namespace: impl Into<String>) -> Self
Sets the workflow’s durable isolation namespace on this row (the routing correctness boundary).
Sourcepub fn with_task_queue(self, task_queue: impl Into<String>) -> Self
pub fn with_task_queue(self, task_queue: impl Into<String>) -> Self
Sets the pool/flavour selector (task queue) on this row.