pub trait EventBus: Send + Sync {
// Required methods
fn publish<'life0, 'async_trait>(
&'life0 self,
event: CloudEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
event_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = EventSubscription> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn subscribe_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = EventSubscription> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn unsubscribe<'life0, 'async_trait>(
&'life0 self,
subscription: EventSubscription,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
subscription: &'life1 mut EventSubscription,
) -> Pin<Box<dyn Future<Output = Option<CloudEvent>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Trait for event bus implementations
Provides publish/subscribe functionality for workflow events.
Used by emit tasks to publish and listen tasks to consume events.
Required Methods§
Sourcefn publish<'life0, 'async_trait>(
&'life0 self,
event: CloudEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn publish<'life0, 'async_trait>(
&'life0 self,
event: CloudEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Publish an event to the bus
Sourcefn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
event_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = EventSubscription> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
event_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = EventSubscription> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Subscribe to events matching a specific type. The subscription starts receiving events from the point of subscription.
Sourcefn subscribe_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = EventSubscription> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn subscribe_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = EventSubscription> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Subscribe to all events
Sourcefn unsubscribe<'life0, 'async_trait>(
&'life0 self,
subscription: EventSubscription,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn unsubscribe<'life0, 'async_trait>(
&'life0 self,
subscription: EventSubscription,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Unsubscribe a previously registered subscription
Sourcefn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
subscription: &'life1 mut EventSubscription,
) -> Pin<Box<dyn Future<Output = Option<CloudEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
subscription: &'life1 mut EventSubscription,
) -> Pin<Box<dyn Future<Output = Option<CloudEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Receive the next event matching a subscription (blocking wait)