Expand description
§Ferro Queue
Background job queue system for the Ferro 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 ferro_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<(), ferro_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§
- Failed
JobInfo - Failed job information
- JobInfo
- Job information for introspection (without full payload data)
- JobPayload
- Serialized job payload stored in the queue.
- Pending
Dispatch - A pending job dispatch.
- Queue
- Queue facade for static access.
- Queue
Config - Queue system configuration.
- Queue
Connection - A connection to the queue backend.
- Queue
Stats - Queue statistics for introspection
- Single
Queue Stats - Statistics for a single queue
- Worker
- Queue worker that processes jobs.
- Worker
Config - Worker configuration.
Enums§
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