pub struct PendingDispatch<J> { /* private fields */ }Expand description
A pending job dispatch.
This builder allows configuring how a job is dispatched before actually sending it to the queue.
Implementations§
Source§impl<J> PendingDispatch<J>
impl<J> PendingDispatch<J>
Sourcepub fn delay(self, duration: Duration) -> Self
pub fn delay(self, duration: Duration) -> Self
Set a delay before the job is available for processing.
Sourcepub async fn dispatch(self) -> Result<(), Error>
pub async fn dispatch(self) -> Result<(), Error>
Dispatch the job to the queue.
In sync mode (QUEUE_CONNECTION=sync), the job is executed immediately
in the current task. This is useful for development and testing.
In redis mode (QUEUE_CONNECTION=redis), the job is pushed to the
Redis queue for background processing by a worker.
Sourcepub fn dispatch_now(self)where
J: Send + 'static,
pub fn dispatch_now(self)where
J: Send + 'static,
Dispatch the job in a background task (fire and forget).
This spawns the dispatch as a background task, useful when you don’t need to wait for the dispatch to complete.
Sourcepub fn dispatch_sync(self)where
J: Send + 'static,
👎Deprecated since 0.2.0: Use dispatch_now() instead
pub fn dispatch_sync(self)where
J: Send + 'static,
Dispatch the job synchronously (fire and forget).
This spawns the dispatch as a background task.
Auto Trait Implementations§
impl<J> Freeze for PendingDispatch<J>where
J: Freeze,
impl<J> RefUnwindSafe for PendingDispatch<J>where
J: RefUnwindSafe,
impl<J> Send for PendingDispatch<J>where
J: Send,
impl<J> Sync for PendingDispatch<J>where
J: Sync,
impl<J> Unpin for PendingDispatch<J>where
J: Unpin,
impl<J> UnwindSafe for PendingDispatch<J>where
J: UnwindSafe,
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> 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