Skip to main content

JobMiddleware

Trait JobMiddleware 

Source
pub trait JobMiddleware: Send + Sync {
    // Required method
    fn call<'a, 'async_trait>(
        &'a self,
        job: &'a Job,
        ctx: &'a WorkerContext,
        next: Next<'a>,
    ) -> Pin<Box<dyn Future<Output = Result<WorkerResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
}
Expand description

A layer that wraps worker.execute for a single job.

Implement call to observe, transform, or short-circuit the execution. To run the rest of the stack, call next.run(job, ctx).await. To skip the stack, return a WorkerResult (or error) without touching next.

Required Methods§

Source

fn call<'a, 'async_trait>( &'a self, job: &'a Job, ctx: &'a WorkerContext, next: Next<'a>, ) -> Pin<Box<dyn Future<Output = Result<WorkerResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Implementors§