pub struct DatabaseQueue { /* private fields */ }Implementations§
Source§impl DatabaseQueue
impl DatabaseQueue
pub fn new(name: &str, db: DatabaseConnection, resolver: JobResolver) -> Self
pub fn with_table(self, table: &str) -> Self
Sourcepub fn with_failed_table(self, table: &str) -> Self
pub fn with_failed_table(self, table: &str) -> Self
Set the name of the failed_jobs table used to record permanent
failures.
pub async fn ensure_table_exists(&self) -> Result<(), JobError>
Sourcepub async fn ensure_failed_table_exists(&self) -> Result<(), JobError>
pub async fn ensure_failed_table_exists(&self) -> Result<(), JobError>
Ensure the failed_jobs table exists (used by Queue::fail).
Sourcepub fn with_batches_table(self, table: &str) -> Self
pub fn with_batches_table(self, table: &str) -> Self
Set the name of the job_batches table used to track batches.
Sourcepub async fn ensure_batches_table_exists(&self) -> Result<(), JobError>
pub async fn ensure_batches_table_exists(&self) -> Result<(), JobError>
Ensure the job_batches table exists.
Sourcepub async fn dispatch_batch(
&self,
pending: &PendingBatch,
) -> Result<JobBatch, JobError>
pub async fn dispatch_batch( &self, pending: &PendingBatch, ) -> Result<JobBatch, JobError>
Dispatch a pending batch (Laravel’s Bus::batch([...])->dispatch()).
Trait Implementations§
Source§impl Clone for DatabaseQueue
impl Clone for DatabaseQueue
Source§impl Debug for DatabaseQueue
impl Debug for DatabaseQueue
Source§impl Queue for DatabaseQueue
impl Queue for DatabaseQueue
Source§fn release<'life0, 'async_trait>(
&'life0 self,
job: JobBox,
attempts: u64,
delay_seconds: u64,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn release<'life0, 'async_trait>(
&'life0 self,
job: JobBox,
attempts: u64,
delay_seconds: u64,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Release the last reserved row back to the queue with a delay, keeping its attempt count. Assumes a single worker per queue instance.
Source§fn fail<'life0, 'async_trait>(
&'life0 self,
job: JobBox,
exception: String,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fail<'life0, 'async_trait>(
&'life0 self,
job: JobBox,
exception: String,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Permanently fail the last reserved row by recording it in the
failed_jobs table and removing it from the jobs table.
Source§fn job_succeeded<'life0, 'async_trait>(
&'life0 self,
job: JobBox,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn job_succeeded<'life0, 'async_trait>(
&'life0 self,
job: JobBox,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Called by the worker after a job finishes successfully: decrements the pending count of the job’s batch (if any) and marks it finished.
fn push<'life0, 'async_trait>(
&'life0 self,
job: JobBox,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn pop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<(JobBox, u64)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<(JobBox, u64)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Pop the next available job together with the number of attempts it has
already consumed (including this one).
fn count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn name(&self) -> &str
Source§fn push_delayed<'life0, 'async_trait>(
&'life0 self,
job: JobBox,
delay_seconds: u64,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn push_delayed<'life0, 'async_trait>(
&'life0 self,
job: JobBox,
delay_seconds: u64,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Push a job that must not be processed before
delay_seconds have
elapsed. The default implementation pushes immediately; backends
that support delayed delivery override this.Auto Trait Implementations§
impl !RefUnwindSafe for DatabaseQueue
impl !UnwindSafe for DatabaseQueue
impl Freeze for DatabaseQueue
impl Send for DatabaseQueue
impl Sync for DatabaseQueue
impl Unpin for DatabaseQueue
impl UnsafeUnpin for DatabaseQueue
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Event for T
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> ⓘ
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