Skip to main content

OutboxRow

Struct OutboxRow 

Source
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: String

Database-level idempotency key, canonically "{workflow_id}:{ordinal}".

§workflow_id: WorkflowId

Workflow that scheduled this fan-out activity.

§ordinal: u64

Pinned 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: String

Workflow’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: String

Pool/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: String

Activity type the worker must execute.

§input: Payload

Opaque activity input payload.

§status: OutboxStatus

Lifecycle state of this row.

§attempt: u32

Zero-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

Source

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.

Source

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.

Source

pub fn with_run_id(self, run_id: Option<RunId>) -> Self

Sets the dispatching run on this row (the run that owns this ordinal).

Source

pub fn with_namespace(self, namespace: impl Into<String>) -> Self

Sets the workflow’s durable isolation namespace on this row (the routing correctness boundary).

Source

pub fn with_task_queue(self, task_queue: impl Into<String>) -> Self

Sets the pool/flavour selector (task queue) on this row.

Source

pub fn with_node(self, node: Option<String>) -> Self

Sets the OPTIONAL node affinity on this row. None = no affinity (any worker in the pool).

Trait Implementations§

Source§

impl Clone for OutboxRow

Source§

fn clone(&self) -> OutboxRow

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OutboxRow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for OutboxRow

Source§

impl PartialEq for OutboxRow

Source§

fn eq(&self, other: &OutboxRow) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for OutboxRow

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.