Skip to main content

SubscriberAdapter

Trait SubscriberAdapter 

Source
pub trait SubscriberAdapter: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn run<'life0, 'async_trait>(
        &'life0 self,
        service: Arc<WorkflowService>,
        cancel: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A subscriber adapter watches events and dispatches workflows.

Each adapter owns its event subscription and handler logic. The WorkflowService provides only execution — adapters decide which workflows to dispatch in response to which events.

Required Methods§

Source

fn name(&self) -> &str

Human-readable name for logging.

Source

fn run<'life0, 'async_trait>( &'life0 self, service: Arc<WorkflowService>, cancel: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start watching events. Runs until cancelled.

The adapter should:

  1. Subscribe to relevant event topics
  2. Loop: receive event → match handlers → dispatch workflows
  3. Exit cleanly when cancel is triggered

Implementors§