Expand description
§Azoth Bus
Multi-consumer pub/sub capabilities built on top of Azoth’s primitives.
The bus provides:
- Named consumers with independent cursors
- Event filtering (by type prefix or custom filters)
- Consumer lag monitoring
- Stream-based organization
§Example
use azoth::AzothDb;
use azoth_bus::EventBus;
use std::sync::Arc;
let db = AzothDb::open("./data")?;
let bus = EventBus::new(Arc::new(db));
// Subscribe to a stream
let mut consumer = bus.subscribe("knowledge", "my-consumer")?;
// Read events (automatically filtered to "knowledge:*")
while let Some(event) = consumer.next()? {
println!("Processing event: {}", event.event_type);
consumer.ack(event.id)?;
}
// Check consumer status
let info = bus.consumer_info("knowledge", "my-consumer")?;
println!("Consumer lag: {}", info.lag);Re-exports§
pub use bus::ConsumerInfo;pub use bus::EventBus;pub use consumer::Consumer;pub use consumer_group::ClaimedEvent;pub use consumer_group::ConsumerGroup;pub use consumer_group::GroupMember;pub use error::BusError;pub use error::Result;pub use filter::EventFilter;pub use notification::WakeStrategy;pub use retention::CompactionStats;pub use retention::RetentionManager;pub use retention::RetentionPolicy;pub use stream::auto_ack_stream;pub use stream::event_stream;pub use stream::ConsumerStream;
Modules§
- bus
- config
- consumer
- consumer_
group - Consumer groups for load-balanced event consumption
- error
- filter
- notification
- Notification system for waking consumers when new events arrive
- retention
- Retention policies for automatic event cleanup
- stream
- Stream-based event consumption for async/await workflows