JobRegistry

Trait JobRegistry 

Source
pub trait JobRegistry<AppState: AppState> {
    // Required method
    fn run_job<'life0, 'life1, 'async_trait>(
        &'life0 self,
        job: &'life1 JobFromDB,
        app_state: AppState,
        cancellation_token: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A trait for job registries that can dispatch jobs based on their name.

This trait is typically implemented using the impl_job_registry! macro, which generates the necessary dispatch logic for all registered job types.

Required Methods§

Source

fn run_job<'life0, 'life1, 'async_trait>( &'life0 self, job: &'life1 JobFromDB, app_state: AppState, cancellation_token: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run a job from the database by dispatching to the appropriate handler.

Implementors§