[][src]Struct cqrs_es::EventEnvelope

pub struct EventEnvelope<A, E> where
    A: Aggregate,
    E: DomainEvent<A>, 
{ pub aggregate_id: String, pub sequence: usize, pub aggregate_type: String, pub payload: E, pub metadata: HashMap<String, String>, // some fields omitted }

EventEnvelope is a data structure that encapsulates an event with along with it's pertinent information. All of the associated data will be transported and persisted together.

Within any system an event must be unique based on its' aggregate_type, aggregate_id and sequence.

Fields

aggregate_id: String

The id of the aggregate instance.

sequence: usize

The sequence number for an aggregate instance.

aggregate_type: String

The type of aggregate the event applies to.

payload: E

The event payload with all business information.

metadata: HashMap<String, String>

Additional metadata for use in auditing, logging or debugging purposes.

Methods

impl<A, E> EventEnvelope<A, E> where
    A: Aggregate,
    E: DomainEvent<A>, 
[src]

pub fn new(
    aggregate_id: String,
    sequence: usize,
    aggregate_type: String,
    payload: E
) -> Self
[src]

A convenience function for packaging an event in an EventEnvelope, used for testing QueryProcessors.

pub fn new_with_metadata(
    aggregate_id: String,
    sequence: usize,
    aggregate_type: String,
    payload: E,
    metadata: HashMap<String, String>
) -> Self
[src]

A convenience function for packaging an event in an EventEnvelope, used for testing QueryProcessors. This version allows custom metadata to also be processed.

Trait Implementations

impl<A, E> Clone for EventEnvelope<A, E> where
    A: Aggregate,
    E: DomainEvent<A>, 
[src]

impl<A: Debug, E: Debug> Debug for EventEnvelope<A, E> where
    A: Aggregate,
    E: DomainEvent<A>, 
[src]

Auto Trait Implementations

impl<A, E> RefUnwindSafe for EventEnvelope<A, E> where
    A: RefUnwindSafe,
    E: RefUnwindSafe

impl<A, E> Send for EventEnvelope<A, E>

impl<A, E> Sync for EventEnvelope<A, E>

impl<A, E> Unpin for EventEnvelope<A, E> where
    A: Unpin,
    E: Unpin

impl<A, E> UnwindSafe for EventEnvelope<A, E> where
    A: UnwindSafe,
    E: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.