Job

Trait Job 

Source
pub trait Job:
    Send
    + Sync
    + RefUnwindSafe
    + Serialize
    + Deserialize {
    // Required method
    fn handle<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn queue(&self) -> String { ... }
    fn tries(&self) -> i16 { ... }
    fn timeout(&self) -> i16 { ... }
    fn backoff(&self, attempt: u32) -> u32 { ... }
    fn failed<'life0, 'async_trait>(
        &'life0 self,
        _err: Error,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn queue(&self) -> String

The name of the queue the job should be dispatched to.

Source

fn tries(&self) -> i16

The number of times the job may be attempted.

Source

fn timeout(&self) -> i16

The number of seconds the job can run before timing out.

Source

fn backoff(&self, attempt: u32) -> u32

Calculate the number of seconds to wait before retrying the job.

Source

fn failed<'life0, 'async_trait>( &'life0 self, _err: Error, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle a job failure.

Trait Implementations§

Source§

impl<'typetag> Serialize for dyn Job + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn Job + Send + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn Job + Send + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn Job + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Implementors§