pulses 0.2.0

A robust, high-performance background job processing library for Rust.
Documentation
//! # Pulses
//!
//! A robust, high-performance background job processing library for Rust.
//!
//! Pulses consumes messages from a pluggable [`Broker`] (a Redis Streams backend
//! ships behind the `redis` feature), routes each message to the [`Handler`]s
//! that subscribe to its stream, and runs those handlers concurrently on the
//! ambient multi-threaded Tokio runtime.
//!
//! ## Highlights
//!
//! - **Type-safe handlers** — register handlers at compile time; their streams
//!   are unioned automatically into the broker subscription, so there is no
//!   stream list to keep in sync by hand.
//! - **Real delivery semantics** — [`Outcome::Retry`] honors its delay and is
//!   bounded by [`AppConfig::handler_max_attempts`]; exhausted or
//!   [`Outcome::DeadLetter`] messages are written to a durable dead-letter
//!   stream before being acknowledged.
//! - **Bounded concurrency & back-pressure** — each handler runs up to a
//!   configurable number of in-flight messages; a saturated handler applies
//!   back-pressure to the reader.
//! - **Graceful shutdown** — on cancellation the runtime stops accepting new
//!   work and drains in-flight handler invocations before returning.
//! - **Reliability** — failed acknowledgements are retried, and pending
//!   messages abandoned by a crashed consumer are reclaimed.
//!
//! See [`App`] for a complete usage example.
//!
//! ## Runtime
//!
//! Pulses spawns its actors with [`tokio::spawn`], so run it inside a
//! multi-threaded runtime (the default `#[tokio::main]`) to process handlers in
//! parallel across cores.

#![forbid(unsafe_code)]
#![warn(missing_docs)]

pub mod app;
pub mod broker;
pub mod config;
pub mod core;
pub mod error;

mod handler_pool;
mod handler_set;
mod runtime;

#[cfg(test)]
pub(crate) mod test_support;

pub use core::Broker;
pub use core::Context;
pub use core::Envelope;
pub use core::Handler;
pub use core::HandlerError;
pub use core::Outcome;
pub use core::Subscription;

pub use app::App;
pub use config::AppConfig;
pub use config::BackoffConfig;
pub use config::ConfigError;
pub use error::AppError;