Skip to main content

Gateway

Trait Gateway 

Source
pub trait Gateway: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn send<'life0, 'async_trait>(
        &'life0 self,
        msg: MessageEvent,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn start<'life0, 'async_trait>(
        &'life0 self,
        db: DatabaseConnection,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A Gateway bridges the sensorium loop with an external communication channel (Slack, HTTP webhook, chat TUI, etc).

Required Methods§

Source

fn name(&self) -> &'static str

Unique, stable identifier for this gateway (e.g. “slack”, “tui”). Used as the key in process_event_deliveries to track per-gateway delivery state.

Source

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

Deliver a message to the external system (called for each ProcessEvent).

Source

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

Start listening for inbound messages, writing them directly to the conversations table. This is expected to run until the gateway shuts down.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§