Trait mq::JobProcessor

source ·
pub trait JobProcessor: Send + Sync {
    // Required methods
    fn poll_next_job<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        queues: &'life1 [&'life2 str]
    ) -> Pin<Box<dyn Future<Output = Result<Option<Job>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn complete_job_with_success<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        queue: &'life1 str,
        kind: &'life2 str,
        id: &'life3 str
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn complete_job_with_cancelled<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        queue: &'life1 str,
        kind: &'life2 str,
        id: &'life3 str,
        message: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn fail_job<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        queue: &'life1 str,
        kind: &'life2 str,
        id: &'life3 str,
        reason: Value
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}

Required Methods§

source

fn poll_next_job<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, queues: &'life1 [&'life2 str] ) -> Pin<Box<dyn Future<Output = Result<Option<Job>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Poll next job. If there are no jobs Ok(None) is returned.

§Priority

Higher priority will be polled first.

source

fn complete_job_with_success<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, queue: &'life1 str, kind: &'life2 str, id: &'life3 str ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Complete the job with success.

source

fn complete_job_with_cancelled<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, queue: &'life1 str, kind: &'life2 str, id: &'life3 str, message: Option<String> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Complete the job with cancel.

source

fn fail_job<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, queue: &'life1 str, kind: &'life2 str, id: &'life3 str, reason: Value ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Fail the job.

Implementors§