pub trait EventBus:
Send
+ Sync
+ 'static {
// Required methods
fn publish(
&self,
topic: &EventTopic,
payload: EventPayload,
) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>>;
fn subscribe(
&self,
topic: &EventTopic,
) -> Pin<Box<dyn Future<Output = Result<SubscriptionHandle, SdkError>> + Send + '_>>;
}Expand description
Kernel-wide pub/sub bus.
Products use this to broadcast agent lifecycle events, kernel state changes, inter-agent messages, and external triggers.
§Subscription model
subscribe returns a SubscriptionHandle that, when dropped or
unsubscribed, stops delivering events. Implementations may use
channels, callbacks, polling, etc.
Required Methods§
Sourcefn publish(
&self,
topic: &EventTopic,
payload: EventPayload,
) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>>
fn publish( &self, topic: &EventTopic, payload: EventPayload, ) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>>
Publish a payload to a topic.
Sourcefn subscribe(
&self,
topic: &EventTopic,
) -> Pin<Box<dyn Future<Output = Result<SubscriptionHandle, SdkError>> + Send + '_>>
fn subscribe( &self, topic: &EventTopic, ) -> Pin<Box<dyn Future<Output = Result<SubscriptionHandle, SdkError>> + Send + '_>>
Subscribe to a topic (exact match or prefix match per impl).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".