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
//! # 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.
pub
pub use Broker;
pub use Context;
pub use Envelope;
pub use Handler;
pub use HandlerError;
pub use Outcome;
pub use Subscription;
pub use App;
pub use AppConfig;
pub use BackoffConfig;
pub use ConfigError;
pub use AppError;