Skip to main content

BatchJobHandler

Trait BatchJobHandler 

Source
pub trait BatchJobHandler: Send + Sync {
    // Required method
    fn handle_batch(
        &self,
        jobs: Vec<Job>,
    ) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send>>;
}
Expand description

A handler that processes a batch of jobs atomically.

Required Methods§

Source

fn handle_batch( &self, jobs: Vec<Job>, ) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send>>

Processes jobs as one unit.

Returning Err leaves the whole batch unacked, so the pool retries it under the usual attempt budget.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F, Fut> BatchJobHandler for F
where F: Fn(Vec<Job>) -> Fut + Send + Sync, Fut: Future<Output = Result<(), JobError>> + Send + 'static,