pub struct TaskMessage {Show 16 fields
pub id: TaskId,
pub task_name: String,
pub queue: String,
pub payload: Value,
pub state: TaskState,
pub retries: u32,
pub max_retries: u32,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub eta: Option<DateTime<Utc>>,
pub headers: HashMap<String, String>,
pub parent_id: Option<TaskId>,
pub correlation_id: Option<String>,
pub group_id: Option<String>,
pub group_total: Option<u32>,
pub chord_callback: Option<Box<TaskMessage>>,
}Expand description
A task message that flows through the broker.
Fields§
§id: TaskIdUnique task identifier.
task_name: StringRegistered task name (e.g., “send_email”).
queue: StringTarget queue name.
payload: ValueSerialized task payload.
state: TaskStateCurrent task state.
retries: u32Current retry count.
max_retries: u32Maximum allowed retries.
created_at: DateTime<Utc>When the message was created.
updated_at: DateTime<Utc>When the message was last updated.
eta: Option<DateTime<Utc>>Optional ETA — earliest time the task should execute.
headers: HashMap<String, String>Arbitrary headers for middleware / tracing propagation.
parent_id: Option<TaskId>Parent task ID for workflow tracking.
correlation_id: Option<String>Correlation ID for tracing an entire workflow.
group_id: Option<String>Group ID this task belongs to.
group_total: Option<u32>Total number of tasks in the group.
chord_callback: Option<Box<TaskMessage>>Chord callback to enqueue when all group members complete.
Implementations§
Source§impl TaskMessage
impl TaskMessage
Sourcepub fn new(
task_name: impl Into<String>,
queue: impl Into<String>,
payload: Value,
) -> TaskMessage
pub fn new( task_name: impl Into<String>, queue: impl Into<String>, payload: Value, ) -> TaskMessage
Create a new task message with defaults.
Sourcepub fn with_max_retries(self, max_retries: u32) -> TaskMessage
pub fn with_max_retries(self, max_retries: u32) -> TaskMessage
Set max retries.
Sourcepub fn with_eta(self, eta: DateTime<Utc>) -> TaskMessage
pub fn with_eta(self, eta: DateTime<Utc>) -> TaskMessage
Set ETA.
Sourcepub fn with_header(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> TaskMessage
pub fn with_header( self, key: impl Into<String>, value: impl Into<String>, ) -> TaskMessage
Add a header.
Sourcepub fn with_parent_id(self, parent_id: TaskId) -> TaskMessage
pub fn with_parent_id(self, parent_id: TaskId) -> TaskMessage
Set parent task ID for workflow tracking.
Sourcepub fn with_correlation_id(
self,
correlation_id: impl Into<String>,
) -> TaskMessage
pub fn with_correlation_id( self, correlation_id: impl Into<String>, ) -> TaskMessage
Set correlation ID for tracing an entire workflow.
Sourcepub fn with_group(
self,
group_id: impl Into<String>,
group_total: u32,
) -> TaskMessage
pub fn with_group( self, group_id: impl Into<String>, group_total: u32, ) -> TaskMessage
Set group metadata.
Sourcepub fn with_chord_callback(self, callback: TaskMessage) -> TaskMessage
pub fn with_chord_callback(self, callback: TaskMessage) -> TaskMessage
Set chord callback.
Trait Implementations§
Source§impl Clone for TaskMessage
impl Clone for TaskMessage
Source§fn clone(&self) -> TaskMessage
fn clone(&self) -> TaskMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TaskMessage
impl Debug for TaskMessage
Source§impl<'de> Deserialize<'de> for TaskMessage
impl<'de> Deserialize<'de> for TaskMessage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TaskMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TaskMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for TaskMessage
impl Serialize for TaskMessage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for TaskMessage
impl RefUnwindSafe for TaskMessage
impl Send for TaskMessage
impl Sync for TaskMessage
impl Unpin for TaskMessage
impl UnsafeUnpin for TaskMessage
impl UnwindSafe for TaskMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more