pub trait Event:
Serialize
+ DeserializeOwned
+ Send
+ Sync
+ 'static {
// Required methods
fn subject(&self) -> Cow<'_, str>;
fn message_id(&self) -> MessageId;
// Provided method
fn aggregate_type() -> &'static str
where Self: Sized { ... }
}Expand description
Marker trait for all events published through the event bus.
Implement manually or use #[derive(Event)] from the bus-macros crate.
Every implementor must have a stable, unique message_id() for idempotency
and deduplication.
Required Methods§
Sourcefn message_id(&self) -> MessageId
fn message_id(&self) -> MessageId
Unique identifier used as the message ID header and idempotency key.
Provided Methods§
Sourcefn aggregate_type() -> &'static strwhere
Self: Sized,
fn aggregate_type() -> &'static strwhere
Self: Sized,
Aggregate type used for outbox routing.
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.