Skip to main content

azoth_bus/
lib.rs

1//! # Azoth Bus
2//!
3//! Multi-consumer pub/sub capabilities built on top of Azoth's primitives.
4//!
5//! The bus provides:
6//! - Named consumers with independent cursors
7//! - Event filtering (by type prefix or custom filters)
8//! - Consumer lag monitoring
9//! - Stream-based organization
10//!
11//! ## Example
12//!
13//! ```rust,no_run
14//! use azoth::AzothDb;
15//! use azoth_bus::EventBus;
16//! use std::sync::Arc;
17//!
18//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
19//! let db = AzothDb::open("./data")?;
20//! let bus = EventBus::new(Arc::new(db));
21//!
22//! // Subscribe to a stream
23//! let mut consumer = bus.subscribe("knowledge", "my-consumer")?;
24//!
25//! // Read events (automatically filtered to "knowledge:*")
26//! while let Some(event) = consumer.next()? {
27//!     println!("Processing event: {}", event.event_type);
28//!     consumer.ack(event.id)?;
29//! }
30//!
31//! // Check consumer status
32//! let info = bus.consumer_info("knowledge", "my-consumer")?;
33//! println!("Consumer lag: {}", info.lag);
34//! # Ok(())
35//! # }
36//! ```
37
38pub mod bus;
39pub mod config;
40pub mod consumer;
41pub mod consumer_group;
42pub mod error;
43pub mod filter;
44pub mod notification;
45pub mod retention;
46pub mod stream;
47
48pub use bus::{ConsumerInfo, EventBus};
49pub use consumer::Consumer;
50pub use consumer_group::{ClaimedEvent, ConsumerGroup, GroupMember};
51pub use error::{BusError, Result};
52pub use filter::EventFilter;
53pub use notification::WakeStrategy;
54pub use retention::{CompactionStats, RetentionManager, RetentionPolicy};
55pub use stream::{auto_ack_stream, event_stream, ConsumerStream};