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
//! Generic Event Publish-Subscribe System
//!
//! This module provides a flexible, async-first event broker implementation
//! inspired by Crush's pubsub.Broker design. It supports multiple subscribers,
//! non-blocking event delivery, and configurable channel capacity.
//!
//! # Features
//!
//! - **Generic Events**: Type-safe events with any payload type
//! - **Multiple Subscribers**: Support for multiple concurrent subscribers
//! - **Non-blocking Delivery**: Slow consumers don't block publishers
//! - **Async Support**: Built on tokio for async operations
//! - **Unsubscribe Support**: Subscribers can be removed at any time
//! - **Configurable Capacity**: Channel buffer size can be configured
//!
//! # Example
//!
//! ```rust,ignore
//! use litellm_rs::utils::event::{EventBroker, Event, EventType};
//!
//! #[derive(Clone, Debug)]
//! struct UserData {
//! id: u64,
//! name: String,
//! }
//!
//! #[tokio::main]
//! async fn main() {
//! let broker = EventBroker::<UserData>::new();
//!
//! // Subscribe to events
//! let mut rx = broker.subscribe();
//!
//! // Publish an event
//! let user = UserData { id: 1, name: "Alice".to_string() };
//! broker.publish(Event::created(user)).await;
//!
//! // Receive the event
//! if let Ok(event) = rx.recv().await {
//! println!("Received: {:?}", event);
//! }
//! }
//! ```
pub use EventBroker;
pub use ;