pub struct Signature {
pub task_name: String,
pub queue: String,
pub payload: Value,
pub max_retries: u32,
pub eta: Option<DateTime<Utc>>,
pub headers: HashMap<String, String>,
}Expand description
A type-erased task invocation descriptor.
Signatures describe what to run without running it immediately.
They can be composed into workflows via Canvas.
Fields§
§task_name: StringRegistered task name.
queue: StringTarget queue.
payload: ValueSerialized task payload.
max_retries: u32Maximum retries.
eta: Option<DateTime<Utc>>Optional ETA.
headers: HashMap<String, String>Arbitrary headers.
Implementations§
Source§impl Signature
impl Signature
Sourcepub fn new(
task_name: impl Into<String>,
queue: impl Into<String>,
payload: Value,
) -> Signature
pub fn new( task_name: impl Into<String>, queue: impl Into<String>, payload: Value, ) -> Signature
Create a new signature.
Sourcepub fn with_max_retries(self, max_retries: u32) -> Signature
pub fn with_max_retries(self, max_retries: u32) -> Signature
Set max retries.
Sourcepub fn with_header(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Signature
pub fn with_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Signature
Add a header.
Sourcepub fn into_message(self) -> TaskMessage
pub fn into_message(self) -> TaskMessage
Convert this signature into a TaskMessage ready for enqueuing.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Signature
impl<'de> Deserialize<'de> for Signature
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Signature, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Signature, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Signature
impl Serialize for Signature
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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Signature
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnsafeUnpin for Signature
impl UnwindSafe for Signature
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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