pub struct ResultMessage {Show 14 fields
pub task_id: Uuid,
pub status: TaskStatus,
pub result: Option<Value>,
pub traceback: Option<String>,
pub exception: Option<ExceptionInfo>,
pub date_done: Option<DateTime<Utc>>,
pub task: Option<String>,
pub worker: Option<String>,
pub retries: Option<u32>,
pub parent_id: Option<Uuid>,
pub root_id: Option<Uuid>,
pub group_id: Option<Uuid>,
pub children: Vec<Uuid>,
pub meta: HashMap<String, Value>,
}Expand description
Task result message (Celery-compatible format)
Fields§
§task_id: UuidTask ID
status: TaskStatusTask status
result: Option<Value>Result value (for SUCCESS)
traceback: Option<String>Traceback (for FAILURE)
exception: Option<ExceptionInfo>Exception info (for FAILURE)
date_done: Option<DateTime<Utc>>Timestamp when result was created
task: Option<String>Task name
worker: Option<String>Worker that executed the task
retries: Option<u32>Retry count
parent_id: Option<Uuid>Parent task ID (for workflows)
root_id: Option<Uuid>Root task ID (for workflows)
group_id: Option<Uuid>Group ID (for grouped tasks)
children: Vec<Uuid>Children task IDs
meta: HashMap<String, Value>Additional metadata
Implementations§
Source§impl ResultMessage
impl ResultMessage
Sourcepub fn new(task_id: Uuid, status: TaskStatus) -> Self
pub fn new(task_id: Uuid, status: TaskStatus) -> Self
Create a new result message
Sourcepub fn failure(task_id: Uuid, exc_type: &str, exc_message: &str) -> Self
pub fn failure(task_id: Uuid, exc_type: &str, exc_message: &str) -> Self
Create a failure result
Sourcepub fn failure_with_traceback(
task_id: Uuid,
exc_type: &str,
exc_message: &str,
traceback: &str,
) -> Self
pub fn failure_with_traceback( task_id: Uuid, exc_type: &str, exc_message: &str, traceback: &str, ) -> Self
Create a failure result with traceback
Sourcepub fn with_worker(self, worker: impl Into<String>) -> Self
pub fn with_worker(self, worker: impl Into<String>) -> Self
Set the worker name
Sourcepub fn with_parent(self, parent_id: Uuid) -> Self
pub fn with_parent(self, parent_id: Uuid) -> Self
Set the parent task ID
Sourcepub fn with_group(self, group_id: Uuid) -> Self
pub fn with_group(self, group_id: Uuid) -> Self
Set the group ID
Sourcepub fn with_child(self, child_id: Uuid) -> Self
pub fn with_child(self, child_id: Uuid) -> Self
Add a child task ID
Sourcepub fn with_children(self, children: Vec<Uuid>) -> Self
pub fn with_children(self, children: Vec<Uuid>) -> Self
Set children task IDs
Sourcepub fn with_retries(self, retries: u32) -> Self
pub fn with_retries(self, retries: u32) -> Self
Set retry count
Sourcepub fn with_date_done(self, date_done: DateTime<Utc>) -> Self
pub fn with_date_done(self, date_done: DateTime<Utc>) -> Self
Set completion timestamp
Sourcepub fn add_meta(&mut self, key: impl Into<String>, value: Value)
pub fn add_meta(&mut self, key: impl Into<String>, value: Value)
Add a single metadata entry (mutable)
Sourcepub fn retry_count(&self) -> u32
pub fn retry_count(&self) -> u32
Get the retry count (defaults to 0 if not set)
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the task succeeded
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Check if the task failed
Sourcepub fn get_result(&self) -> Option<&Value>
pub fn get_result(&self) -> Option<&Value>
Get the result value (if success)
Sourcepub fn get_exception(&self) -> Option<&ExceptionInfo>
pub fn get_exception(&self) -> Option<&ExceptionInfo>
Get the exception info (if failure)
Trait Implementations§
Source§impl Clone for ResultMessage
impl Clone for ResultMessage
Source§fn clone(&self) -> ResultMessage
fn clone(&self) -> ResultMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more