Struct background_jobs::QueueHandle[][src]

pub struct QueueHandle { /* fields omitted */ }

A handle to the job server, used for queuing new jobs

QueueHandle should be stored in your application's state in order to allow all parts of your application to spawn jobs.

Implementations

impl QueueHandle[src]

pub fn queue<J>(&self, job: J) -> Result<(), Error> where
    J: Job
[src]

Queues a job for execution

This job will be sent to the server for storage, and will execute whenever a worker for the job's queue is free to do so.

pub fn schedule<J>(&self, job: J, after: DateTime<Utc>) -> Result<(), Error> where
    J: Job
[src]

Schedule a job for execution later

This job will be sent to the server for storage, and will execute after the specified time and when a worker for the job's queue is free to do so.

pub fn every<J>(&self, duration: Duration, job: J) where
    J: Job + Clone + Send + 'static, 
[src]

Queues a job for recurring execution

This job will be added to it's queue on the server once every Duration. It will be processed whenever workers are free to do so.

pub async fn get_stats(&'_ self) -> Result<Stats, Error>[src]

Return an overview of the processor's statistics

Trait Implementations

impl Clone for QueueHandle[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.