Skip to main content

EventBus

Trait EventBus 

Source
pub trait EventBus: Send + Sync {
    // Required methods
    fn publish(&self, event: FleetEvent);
    fn subscribe(&self, stream_key: &str) -> BusSubscription;
    fn subscribe_all(&self) -> BusSubscription;
}
Expand description

Publishes events to live subscribers.

Required Methods§

Source

fn publish(&self, event: FleetEvent)

Fan an event out to current subscribers. Never blocks on slow/absent receivers (delivery is best-effort relative to the durable store).

Source

fn subscribe(&self, stream_key: &str) -> BusSubscription

A live subscription to one stream’s events. The returned stream yields only events whose stream key equals stream_key; consumers dedup the initial-history/live overlap on seq.

Source

fn subscribe_all(&self) -> BusSubscription

A live subscription to EVERY stream’s events, unfiltered. Needed by fleet-wide watchers (e.g. FleetManager::watch_changes) that can’t name a stream key in advance — a brand-new agent’s own id keys its AgentDiscovered event, so no one can pre-subscribe to it by key.

Implementors§