Trait background_jobs::Job

source ·
pub trait Job: Serialize + DeserializeOwned {
    fn run(
        self
    ) -> Box<dyn Future<Error = Error, Item = ()> + Send + 'static, Global>; fn queue(&self) -> Option<&str> { ... } fn max_retries(&self) -> Option<MaxRetries> { ... } fn backoff_strategy(&self) -> Option<Backoff> { ... } }
Expand description

The Job trait defines parameters pertaining to an instance of background job

Required Methods§

Users of this library must define what it means to run a job.

This should contain all the logic needed to complete a job. If that means queuing more jobs, sending an email, shelling out (don’t shell out), or doing otherwise lengthy processes, that logic should all be called from inside this method.

Provided Methods§

If this job should not use the default queue for its processor, this can be overridden in user-code.

Jobs will only be processed by processors that are registered, and if a queue is supplied here that is not associated with a valid processor for this job, it will never be processed.

If this job should not use the default maximum retry count for its processor, this can be overridden in user-code.

If this job should not use the default backoff strategy for its processor, this can be overridden in user-code.

Implementors§