src/queue.rs

tako · tako-rs-core/src/queue.rs · rust · MIT
unclassified

! In-memory background job queue with retries, delayed and deduplicated jobs, a dead letter ! queue and graceful shutdown. ! ! # Examples ! ! ```rust,no_run ! use tako::queue::{Queue, RetryPolicy, Job}; ! use std::time::Duration;

// Source: https://github.com/rust-dd/tako | License: MIT | Copyright 2025 Daniel Boros / Rust-DD
// Provided via justclaw.it.com; keep this notice with the code.
//! In-memory background job queue with retries, delayed and deduplicated jobs, a dead letter
//! queue and graceful shutdown.
//!
//! # Examples
//!
//! ```rust,no_run
//! use tako::queue::{Queue, RetryPolicy, Job};
//! use std::time::Duration;
//!
//! # async fn example() {
//! let queue = Queue::builder()
//!     .workers(4)
//!     .retry(RetryPolicy::exponential(3, Duration::from_secs(1)))
//!     .build();
//!
//! queue.register("send_email", |job: Job| async move {
//!     let to = job.deserialize::<String>()?;
//!     println!("Sending email to {to}");
//!     Ok(())
//! });
//!
//! queue.push("send_email", &"user@example

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key