Skip to main content

MessageBusPort

Trait MessageBusPort 

Source
pub trait MessageBusPort: Send + Sync {
    // Required methods
    fn send<'life0, 'async_trait>(
        &'life0 self,
        msg: OutboundMessage,
    ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn recv<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<InboundMessage, AgentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Port for message bus communication between bot and agent layers.

Decouples chat adapters from the agent runtime by providing a typed async channel abstraction. The bot layer pushes InboundMessages onto the bus, and the agent layer consumes them. The agent layer pushes OutboundMessages for the bot layer to deliver to channels.

Required Methods§

Source

fn send<'life0, 'async_trait>( &'life0 self, msg: OutboundMessage, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send an outbound message to the bus.

Source

fn recv<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<InboundMessage, AgentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Receive the next inbound message (blocks until available).

Implementors§