1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! In-memory background job queue with named queues, retry policies, and dead letter support.
//!
//! Provides a lightweight task queue for deferring work to background workers —
//! useful for sending emails, webhooks, async processing, etc.
//!
//! # Features
//!
//! - **Named queues** — separate logical channels (e.g. `"email"`, `"webhook"`)
//! - **Configurable workers** — per-queue concurrency limit
//! - **Retry policy** — fixed or exponential backoff with max attempts
//! - **Delayed jobs** — schedule execution after a duration
//! - **Dead letter queue** — failed jobs stored for inspection
//! - **Graceful shutdown** — drain in-flight jobs before exit
//!
//! # 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: String = job.deserialize()?;
//! println!("Sending email to {to}");
//! Ok(())
//! });
//!
//! queue.push("send_email", &"user@example.com").await.unwrap();
//! # }
//! ```
/// Pluggable queue backend abstraction (v2). The bundled `Queue` keeps its
/// in-process semantics; opt into a remote broker via [`backend::QueueBackend`].
/// Builder for configuring a [`Queue`].
/// Cron scheduling on top of `QueueBackend` (opt-in via `queue-cron` feature).
/// Error type for queue operations.
/// Job and dead-letter task types.
/// Retry/backoff configuration.
/// Queue runtime: builder and lifecycle handles.
/// Queue signal ids and emission helper.
/// Background worker loop draining pending jobs.
pub use QueueBuilder;
pub use QueueError;
pub use DeadJob;
pub use Job;
pub use RetryPolicy;
pub use Queue;
pub use emit_queue_signal;
pub use signal_ids;