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§
Sourcefn 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,
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:
- Subscribe to relevant event topics
- Loop: receive event → match handlers → dispatch workflows
- Exit cleanly when
cancelis triggered