pub trait EventPublisher: Send + Sync {
// Provided method
fn publish_event<'life0, 'life1, 'async_trait>(
&'life0 self,
_event_name: &'life1 str,
_data: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
A trait for publishing wasmbus events. This can be implemented by any transport or bus implementation that can send the serialized event to the appropriate destination.
TODO(#4408): This trait can certainly be enhanced by having a more strongly typed event, e.g. WasmbusEvent which implements Serialize.
Provided Methods§
Sourcefn publish_event<'life0, 'life1, 'async_trait>(
&'life0 self,
_event_name: &'life1 str,
_data: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn publish_event<'life0, 'life1, 'async_trait>(
&'life0 self,
_event_name: &'life1 str,
_data: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Publish an event that occurred in the host. The event name is the type of event being published, and the data is the payload of the event. It’s up to the implementation to determine how to handle events. By default, this is a no-op.