nitinol_eventstream/process/
publisher.rs

1use async_trait::async_trait;
2use nitinol_core::event::Event;
3use nitinol_process::{Context, Process};
4
5#[async_trait]
6pub trait WithStreamPublisher: 'static + Sync + Send 
7where
8    Self: Process
9{
10    async fn publish<E: Event>(&self, event: &E, ctx: &mut Context) {
11        crate::global::get_event_stream()
12            .publish(self.aggregate_id(), ctx.sequence(), event)
13            .await;
14    }
15}
16
17impl<T> WithStreamPublisher for T where T: Process {}