pub struct ClaimedTask {
pub task_id: String,
pub kind: String,
pub payload: Value,
pub attempt: u32,
pub max_attempts: u32,
pub idempotency_key: Option<String>,
pub run_id: Option<String>,
pub thread_id: Option<String>,
pub cancel_requested: bool,
pub deadline: Option<DateTime<Utc>>,
}Expand description
The task a worker receives on a successful claim: the fields of the
server’s task record a worker needs (POST /tasks/claim →
{"task": {…}}). Fields the worker does not consume are ignored on
deserialization, so additive server-side evolution keeps working.
Fields§
§task_id: StringThe server-minted task id, used to address heartbeat/complete/fail.
kind: StringThe dispatch label the worker’s handler registry is keyed by.
payload: ValueThe work payload, exactly as enqueued.
attempt: u32The 1-based attempt ordinal (higher after a requeue).
max_attempts: u32The attempt ceiling configured at enqueue time.
idempotency_key: Option<String>The dedup key supplied at enqueue time, if any.
run_id: Option<String>Run linkage (reserved for the run-side outbox wave); carried into the activity’s tracing span when present.
thread_id: Option<String>See ClaimedTask::run_id.
cancel_requested: boolCancellation signalled before the claim was handed out. A well-behaved server never leases such a task (its claim path finalizes them as cancelled), but the worker defends anyway: a claimed task with this flag is reported cancelled without running the handler.
deadline: Option<DateTime<Utc>>Whole-task deadline, across attempts. The worker refuses to start
an attempt past it and aborts a running attempt at it, reporting
ErrorClass::Cancelled — deadline expiry is cancellation by
clock, per the Durable Work design.
Trait Implementations§
Source§impl Clone for ClaimedTask
impl Clone for ClaimedTask
Source§fn clone(&self) -> ClaimedTask
fn clone(&self) -> ClaimedTask
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more