pub struct TaskBuilder<Args> { /* private fields */ }Expand description
Builder for creating Task instances with optional configuration
Implementations§
Source§impl<Args> TaskBuilder<Args>
impl<Args> TaskBuilder<Args>
Sourcepub fn new(args: Args) -> TaskBuilder<Args>
pub fn new(args: Args) -> TaskBuilder<Args>
Create a new TaskBuilder with the required args
Sourcepub fn with_metadata(self, metadata: MetadataStore) -> TaskBuilder<Args>
pub fn with_metadata(self, metadata: MetadataStore) -> TaskBuilder<Args>
Set the task’s metadata
Sourcepub fn with_data(self, data: Extensions) -> TaskBuilder<Args>
pub fn with_data(self, data: Extensions) -> TaskBuilder<Args>
Set the task’s runtime data
Sourcepub fn data<D>(self, value: D) -> TaskBuilder<Args>
pub fn data<D>(self, value: D) -> TaskBuilder<Args>
Insert a value into the task’s data context
Sourcepub fn metadata<M>(self, value: &M) -> TaskBuilder<Args>
pub fn metadata<M>(self, value: &M) -> TaskBuilder<Args>
Insert a value into the task’s metadata
Sourcepub fn task_id(self, task_id: TaskId) -> TaskBuilder<Args>
pub fn task_id(self, task_id: TaskId) -> TaskBuilder<Args>
Set the task ID
Sourcepub fn attempt(self, attempt: usize) -> TaskBuilder<Args>
pub fn attempt(self, attempt: usize) -> TaskBuilder<Args>
Set the attempt information
Sourcepub fn status(self, status: Status) -> TaskBuilder<Args>
pub fn status(self, status: Status) -> TaskBuilder<Args>
Set the task status
Sourcepub fn max_attempts(self, max_attempts: usize) -> TaskBuilder<Args>
pub fn max_attempts(self, max_attempts: usize) -> TaskBuilder<Args>
Set the maximum number of attempts allowed for the task
Sourcepub fn priority(self, priority: usize) -> TaskBuilder<Args>
pub fn priority(self, priority: usize) -> TaskBuilder<Args>
Set the priority of the task
Sourcepub fn queue(self, queue: Queue) -> TaskBuilder<Args>
pub fn queue(self, queue: Queue) -> TaskBuilder<Args>
Set the queue this task belongs to
Sourcepub fn run_at_timestamp(self, timestamp: u64) -> TaskBuilder<Args>
pub fn run_at_timestamp(self, timestamp: u64) -> TaskBuilder<Args>
Schedule the task to run at a specific Unix timestamp
Sourcepub fn run_at_time(self, time: SystemTime) -> TaskBuilder<Args>
pub fn run_at_time(self, time: SystemTime) -> TaskBuilder<Args>
Schedule the task to run at a specific SystemTime
Sourcepub fn run_after(self, delay: Duration) -> TaskBuilder<Args>
pub fn run_after(self, delay: Duration) -> TaskBuilder<Args>
Schedule the task to run after a delay from now
Sourcepub fn run_in_seconds(self, seconds: u64) -> TaskBuilder<Args>
pub fn run_in_seconds(self, seconds: u64) -> TaskBuilder<Args>
Schedule the task to run in the specified number of seconds
Sourcepub fn run_in_minutes(self, minutes: u64) -> TaskBuilder<Args>
pub fn run_in_minutes(self, minutes: u64) -> TaskBuilder<Args>
Schedule the task to run in the specified number of minutes
Sourcepub fn run_in_hours(self, hours: u64) -> TaskBuilder<Args>
pub fn run_in_hours(self, hours: u64) -> TaskBuilder<Args>
Schedule the task to run in the specified number of hours
Sourcepub fn idempotency_key<S>(self, idempotency_key: S) -> TaskBuilder<Args>
pub fn idempotency_key<S>(self, idempotency_key: S) -> TaskBuilder<Args>
Set the idempotency key
Sourcepub fn done_at(self, done_at: Option<u64>) -> TaskBuilder<Args>
pub fn done_at(self, done_at: Option<u64>) -> TaskBuilder<Args>
Set the time the task was completed
Sourcepub fn lock_at(self, lock_at: Option<u64>) -> TaskBuilder<Args>
pub fn lock_at(self, lock_at: Option<u64>) -> TaskBuilder<Args>
Set the time the task was locked
Sourcepub fn lock_by(self, lock_by: Option<String>) -> TaskBuilder<Args>
pub fn lock_by(self, lock_by: Option<String>) -> TaskBuilder<Args>
Set the worker/process identifier holding the lock on this task
Source§impl<Args> TaskBuilder<Args>
impl<Args> TaskBuilder<Args>
Sourcepub fn try_map_args<F, NewArgs, Err>(
self,
f: F,
) -> Result<TaskBuilder<NewArgs>, Err>
pub fn try_map_args<F, NewArgs, Err>( self, f: F, ) -> Result<TaskBuilder<NewArgs>, Err>
Maps the args field using the provided function, returning a result.
Sourcepub fn map_args<F, NewArgs>(self, f: F) -> TaskBuilder<NewArgs>where
F: FnOnce(Args) -> NewArgs,
pub fn map_args<F, NewArgs>(self, f: F) -> TaskBuilder<NewArgs>where
F: FnOnce(Args) -> NewArgs,
Maps the args field using the provided function, returning the new args.
Sourcepub fn map_context<F>(self, f: F) -> TaskBuilder<Args>
pub fn map_context<F>(self, f: F) -> TaskBuilder<Args>
Maps only the execution_context field.
Trait Implementations§
Source§impl<Args> Debug for TaskBuilder<Args>where
Args: Debug,
impl<Args> Debug for TaskBuilder<Args>where
Args: Debug,
Source§impl<'de, Args> Deserialize<'de> for TaskBuilder<Args>where
Args: Deserialize<'de>,
impl<'de, Args> Deserialize<'de> for TaskBuilder<Args>where
Args: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TaskBuilder<Args>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TaskBuilder<Args>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<Args> RetryMetadataExt for TaskBuilder<Args>
impl<Args> RetryMetadataExt for TaskBuilder<Args>
Source§fn retries(self, retries: usize) -> TaskBuilder<Args>
fn retries(self, retries: usize) -> TaskBuilder<Args>
Set number of retries in the metadata
Source§impl<Args> Serialize for TaskBuilder<Args>where
Args: Serialize,
impl<Args> Serialize for TaskBuilder<Args>where
Args: Serialize,
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<Args> !RefUnwindSafe for TaskBuilder<Args>
impl<Args> !UnwindSafe for TaskBuilder<Args>
impl<Args> Forget for TaskBuilder<Args>
impl<Args> Freeze for TaskBuilder<Args>where
Args: Freeze,
impl<Args> Move for TaskBuilder<Args>
impl<Args> Send for TaskBuilder<Args>where
Args: Send,
impl<Args> Sync for TaskBuilder<Args>where
Args: Sync,
impl<Args> Unpin for TaskBuilder<Args>where
Args: Unpin,
impl<Args> UnsafeUnpin for TaskBuilder<Args>where
Args: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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