EventBus
Defined in the bus module.Rust AI Agent SDK Event bus for publish-subscribe messaging.
Fields
| Name | Type | Description |
|---|---|---|
subscriptions | RwLock<HashMap<EventType | Subscriptions by event type |
global_subscriptions | RwLock<Vec<Subscription>> | Global subscriptions (receive all events) |
next_id | RwLock<usize> | Next subscription ID |
history | RwLock<Vec<Event>> | Event history (optional) |
max_history | usize | Max history size |
Methods
new
with_history
| Name | Type |
|---|---|
max_history | usize |
unsubscribe
| Name | Type |
|---|---|
subscription_id | usize |
publish
| Name | Type |
|---|---|
event | Event |
history
events_by_type
| Name | Type |
|---|---|
event_type | EventType |
events_by_source
| Name | Type |
|---|---|
source | &str |
clear_history
subscription_count
| Name | Type |
|---|---|
event_type | EventType |
total_subscriptions
Source
View on GitHub
praisonai/src/bus/mod.rs at line 201
