Skip to main content

Worker

Trait Worker 

Source
pub trait Worker:
    Send
    + Sync
    + 'static {
    // Required methods
    fn kind(&self) -> &'static str;
    fn perform<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        job_row: &'life1 JobRow,
        ctx: &'life2 JobContext,
    ) -> Pin<Box<dyn Future<Output = Result<JobResult, JobError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Worker trait — implement this for each job type.

Required Methods§

Source

fn kind(&self) -> &'static str

The kind string for this worker (must match the job’s kind).

Source

fn perform<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, job_row: &'life1 JobRow, ctx: &'life2 JobContext, ) -> Pin<Box<dyn Future<Output = Result<JobResult, JobError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute the job. The raw args JSON and context are provided.

Implementors§