pub trait Queue:
Send
+ Sync
+ Debug {
// Required methods
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;
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 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;
// Provided methods
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 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 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 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 { ... }
}Required Methods§
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,
Sourcefn 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
Provided Methods§
Sourcefn 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.
Sourcefn 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,
Requeue a job after a failed attempt, optionally delaying it by
delay_seconds. The default implementation re-pushes immediately.
Sourcefn 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,
Mark a job as permanently failed. exception carries the failure
reason (mirrors Laravel’s queue.failer recording). The default
implementation drops the job.
Sourcefn 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. Queues that
track batch progress (e.g. DatabaseQueue) override this.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".