QueueBackend

Trait QueueBackend 

Source
pub trait QueueBackend: Send + Sync {
    // Required methods
    fn enqueue<'life0, 'life1, 'async_trait>(
        &'life0 self,
        job_type: &'life1 str,
        payload: Value,
        delay_secs: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<Uuid, QueueError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn dequeue<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<JobEntry>, QueueError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_status<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
        status: JobStatus,
        error: Option<String>,
        delay_secs: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_status<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<JobStatus, QueueError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn enqueue<'life0, 'life1, 'async_trait>( &'life0 self, job_type: &'life1 str, payload: Value, delay_secs: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Uuid, QueueError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Enqueue a job payload

Source

fn dequeue<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<JobEntry>, QueueError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Pull next available job

Source

fn update_status<'life0, 'async_trait>( &'life0 self, id: Uuid, status: JobStatus, error: Option<String>, delay_secs: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update job status (ack/nack) delay_secs is used for retries - how long to wait before the job is available again

Source

fn get_status<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<JobStatus, QueueError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get job status

Implementors§