Skip to main content

mytheclipse_queue/
lib.rs

1//! # mytheclipse-queue
2//!
3//! A job queue abstraction so your background work isn't locked to one
4//! transport. Provides a single [`Queue`] trait, [`Job`] type, and `WorkerPool`
5//! executor with configurable retry/backoff, concurrency, and a dead-letter
6//! queue.
7//!
8//! The backend that ships is in-memory (`InMemoryQueue`, feature `in-memory`):
9//! `tokio::sync::mpsc` plus task spawning, no external service. `Queue` is a
10//! trait, so another transport can implement it without touching `WorkerPool`.
11
12pub mod error;
13#[cfg(feature = "in-memory")]
14pub mod in_memory;
15pub mod job;
16pub mod traits;
17#[cfg(feature = "in-memory")]
18pub mod worker;
19
20pub use error::{JobError, QueueError};
21#[cfg(feature = "in-memory")]
22pub use in_memory::InMemoryQueue;
23pub use job::{Job, JobId};
24pub use traits::Queue;
25#[cfg(feature = "in-memory")]
26pub use worker::{JobFuture, JobHandler, WorkerConfig, WorkerPool};
27
28#[cfg(feature = "in-memory")]
29pub mod backpressure_enqueue;
30#[cfg(feature = "in-memory")]
31pub mod batch;
32#[cfg(feature = "in-memory")]
33pub mod rate_limited;
34#[cfg(feature = "in-memory")]
35pub mod worker_rate_limited;
36#[cfg(feature = "in-memory")]
37pub use backpressure_enqueue::{
38    enqueue_with_backpressure, BackpressureEnforcer, BackpressureError,
39};
40#[cfg(feature = "in-memory")]
41pub use rate_limited::{RateLimitQueueError, RateLimitedQueue};
42#[cfg(feature = "in-memory")]
43pub use worker_rate_limited::RateLimitedWorkerPool;
44
45#[cfg(feature = "in-memory")]
46pub mod pipeline;
47#[cfg(feature = "in-memory")]
48pub use pipeline::{Stage, StageError, StageRunner};