Trait QueueServiceTrait

Source
pub trait QueueServiceTrait: Send + Sync {
    // Required methods
    fn add_job<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        queue_name: &'life1 str,
        job: JobData,
    ) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_next_job<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        queue_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = RedisResult<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn count_jobs<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        queue_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = RedisResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_job_progress<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        queue_name: &'life1 str,
        job_id: &'life2 str,
        progress: u32,
    ) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_job_progress<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        queue_name: &'life1 str,
        job_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = RedisResult<u32>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn move_to_failed<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        queue_name: &'life1 str,
        job: JobData,
    ) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn log_job_status<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        queue_name: &'life1 str,
        job: &'life2 JobData,
        status: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}

Required Methods§

Source

fn add_job<'life0, 'life1, 'async_trait>( &'life0 mut self, queue_name: &'life1 str, job: JobData, ) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Adds a job to the specified queue.

§Arguments
  • queue_name - The name of the queue to add the job to.
  • job - The job data to add to the queue.
§Returns

A RedisResult indicating the success or failure of the operation.

Source

fn get_next_job<'life0, 'life1, 'async_trait>( &'life0 mut self, queue_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = RedisResult<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves the next job from the specified queue.

§Arguments
  • queue_name - The name of the queue to retrieve the job from.
§Returns

A RedisResult containing an optional job JSON string.

Source

fn count_jobs<'life0, 'life1, 'async_trait>( &'life0 mut self, queue_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = RedisResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Counts the number of jobs in the specified queue.

§Arguments
  • queue_name - The name of the queue to count the jobs in.
§Returns

A RedisResult containing the number of jobs in the queue.

Source

fn update_job_progress<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, queue_name: &'life1 str, job_id: &'life2 str, progress: u32, ) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Updates the progress of a job.

§Arguments
  • queue_name - The name of the queue the job belongs to.
  • job_id - The ID of the job.
  • progress - The progress value to update.
§Returns

A RedisResult indicating the success or failure of the operation.

Source

fn get_job_progress<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, queue_name: &'life1 str, job_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = RedisResult<u32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieves the progress of a job.

§Arguments
  • queue_name - The name of the queue the job belongs to.
  • job_id - The ID of the job.
§Returns

A RedisResult containing the progress value of the job.

Source

fn move_to_failed<'life0, 'life1, 'async_trait>( &'life0 mut self, queue_name: &'life1 str, job: JobData, ) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Moves a job to the failed queue.

§Arguments
  • queue_name - The name of the queue the job belongs to.
  • job - The job data to move to the failed queue.
§Returns

A RedisResult indicating the success or failure of the operation.

Source

fn log_job_status<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, queue_name: &'life1 str, job: &'life2 JobData, status: &'life3 str, ) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Logs the status of a job.

§Arguments
  • queue_name - The name of the queue the job belongs to.
  • job - A reference to the job data.
  • status - The status message to log.
§Returns

A RedisResult indicating the success or failure of the operation.

Implementors§