Worker

Trait Worker 

Source
pub trait Worker<Args>: Send + Sync {
    // Required method
    fn perform<'life0, 'async_trait>(
        &'life0 self,
        args: Args,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided methods
    fn disable_argument_coercion(&self) -> bool { ... }
    fn opts() -> WorkerOpts<Args, Self>
       where Self: Sized { ... }
    fn max_retries(&self) -> usize { ... }
    fn class_name() -> String
       where Self: Sized { ... }
    fn perform_async<'life0, 'async_trait>(
        redis: &'life0 Pool<RedisConnectionManager>,
        args: Args,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: Sized + 'async_trait,
             Args: Send + Sync + Serialize + 'static { ... }
    fn perform_in<'life0, 'async_trait>(
        redis: &'life0 Pool<RedisConnectionManager>,
        duration: Duration,
        args: Args,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: Sized + 'async_trait,
             Args: Send + Sync + Serialize + 'static { ... }
}

Required Methods§

Source

fn perform<'life0, 'async_trait>( &'life0 self, args: Args, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Provided Methods§

Source

fn disable_argument_coercion(&self) -> bool

Signal to WorkerRef to not attempt to modify the JsonValue args before calling the perform function. This is useful if the args are expected to be a Vec<T> that might be len() == 1 or a single sized tuple (T,).

Source

fn opts() -> WorkerOpts<Args, Self>
where Self: Sized,

Source

fn max_retries(&self) -> usize

Source

fn class_name() -> String
where Self: Sized,

Derive a class_name from the Worker type to be used with sidekiq. By default this method will

Source

fn perform_async<'life0, 'async_trait>( redis: &'life0 Pool<RedisConnectionManager>, args: Args, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sized + 'async_trait, Args: Send + Sync + Serialize + 'static,

Source

fn perform_in<'life0, 'async_trait>( redis: &'life0 Pool<RedisConnectionManager>, duration: Duration, args: Args, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sized + 'async_trait, Args: Send + Sync + Serialize + 'static,

Implementors§

Source§

impl Worker<Email> for MailerWorker

Implementation of the Worker trait for the MailerWorker.