Crate ferro_queue

Crate ferro_queue 

Source
Expand description

§Cancer Queue

Background job queue system for the Cancer framework.

Provides a Laravel-inspired queue system with support for:

  • Redis-backed job queues
  • Job delays and retries
  • Multiple named queues
  • Job chaining
  • Graceful shutdown

§Example

use cancer_queue::{Job, Queueable, dispatch};
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
struct SendEmail {
    to: String,
    subject: String,
}

#[async_trait::async_trait]
impl Job for SendEmail {
    async fn handle(&self) -> Result<(), cancer_queue::Error> {
        println!("Sending email to {}: {}", self.to, self.subject);
        Ok(())
    }
}

// Dispatch a job
SendEmail { to: "user@example.com".into(), subject: "Hello".into() }
    .dispatch()
    .await?;

// Dispatch with delay
SendEmail { to: "user@example.com".into(), subject: "Reminder".into() }
    .delay(std::time::Duration::from_secs(60))
    .on_queue("emails")
    .dispatch()
    .await?;

Structs§

FailedJobInfo
Failed job information
JobInfo
Job information for introspection (without full payload data)
JobPayload
Serialized job payload stored in the queue.
PendingDispatch
A pending job dispatch.
Queue
Queue facade for static access.
QueueConfig
Queue system configuration.
QueueConnection
A connection to the queue backend.
QueueStats
Queue statistics for introspection
SingleQueueStats
Statistics for a single queue
Worker
Queue worker that processes jobs.
WorkerConfig
Worker configuration.

Enums§

Error
Errors that can occur in the queue system.
JobState
Job state for introspection

Traits§

Job
A job that can be executed by a queue worker.
Queueable
Trait for types that can be dispatched to a queue.

Functions§

dispatch
Dispatch a job using the global queue.
dispatch_later
Dispatch a job with a delay.
dispatch_to
Dispatch a job to a specific queue.

Attribute Macros§

async_trait
Re-export async_trait for convenience