pub trait EventManager {
// Required methods
fn send<'life0, 'life1, 'async_trait, T>(
&'life0 mut self,
tenant: &'life1 str,
t: T,
) -> Pin<Box<dyn Future<Output = EventResult<()>> + Send + 'async_trait>>
where T: EventType + Serialize + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn add_consumer<T, C>(
&mut self,
tenant: &str,
c: C,
) -> EventResult<ConsumerID>
where T: EventType + 'static + Sync + Send + DeserializeOwned,
C: Consumer<T> + 'static + Clone + Sync + Send;
fn remove_consumer(&mut self, cid: &ConsumerID) -> EventResult<()>;
fn close(&mut self) -> EventResult<()>;
fn clean(&mut self) -> EventResult<()>;
}
Expand description
The Event Manager is the main trait, offering functions to send and consume events
Required Methods§
Sourcefn send<'life0, 'life1, 'async_trait, T>(
&'life0 mut self,
tenant: &'life1 str,
t: T,
) -> Pin<Box<dyn Future<Output = EventResult<()>> + Send + 'async_trait>>
fn send<'life0, 'life1, 'async_trait, T>( &'life0 mut self, tenant: &'life1 str, t: T, ) -> Pin<Box<dyn Future<Output = EventResult<()>> + Send + 'async_trait>>
Send an event optionally related to a tenant (use empty string for no tenant)
Sourcefn add_consumer<T, C>(&mut self, tenant: &str, c: C) -> EventResult<ConsumerID>
fn add_consumer<T, C>(&mut self, tenant: &str, c: C) -> EventResult<ConsumerID>
Add a consumer to handle specific events, optionally for a specific tenant (use empty string for no tenant)
Sourcefn remove_consumer(&mut self, cid: &ConsumerID) -> EventResult<()>
fn remove_consumer(&mut self, cid: &ConsumerID) -> EventResult<()>
Remove a consumer given its ID
Sourcefn close(&mut self) -> EventResult<()>
fn close(&mut self) -> EventResult<()>
Close the manager and all the resources it holds
Sourcefn clean(&mut self) -> EventResult<()>
fn clean(&mut self) -> EventResult<()>
Clean the underlying system, usually to ensure tests start from a clean slate
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.