Trait Worker

Source
pub trait Worker:
    Send
    + Sync
    + UnwindSafe {
    type Context: Clone + Send + Sync;
    type Error: Error + Send + Sync;

    // Required method
    fn process<'life0, 'life1, 'async_trait>(
        &'life0 self,
        data: &'life1 Context<Self::Context>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn max_retries(&self) -> u32 { ... }
    fn retry_delay(&self, retries: u32) -> u64 { ... }
    fn unique_id(&self) -> Option<String> { ... }
}

Required Associated Types§

Required Methods§

Source

fn process<'life0, 'life1, 'async_trait>( &'life0 self, data: &'life1 Context<Self::Context>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn max_retries(&self) -> u32

Source

fn retry_delay(&self, retries: u32) -> u64

Source

fn unique_id(&self) -> Option<String>

Implementors§