pub struct EventSourcedOrchestratingAggregate<'a, C, S, E, Repository, Version, Error>where
Repository: EventRepository<C, E, Version, Error>,{ /* private fields */ }
Expand description
Orchestrating Event Sourced Aggregate.
It is using a Decider and Saga to compute new events based on the current events and the command.
If the decider
is combined out of many deciders via combine
function, a saga
could be used to react on new events and send new commands to the decider
recursively, in single transaction.
It is using a EventRepository to fetch the current events and to save the new events.
Generic parameters:
C
- CommandS
- StateE
- EventRepository
- Event repositoryVersion
- Version/Offset/Sequence numberError
- Error
Implementations§
Source§impl<'a, C, S, E, Repository, Version, Error> EventSourcedOrchestratingAggregate<'a, C, S, E, Repository, Version, Error>
impl<'a, C, S, E, Repository, Version, Error> EventSourcedOrchestratingAggregate<'a, C, S, E, Repository, Version, Error>
Sourcepub fn new(
repository: Repository,
decider: Decider<'a, C, S, E, Error>,
saga: Saga<'a, E, C>,
) -> Self
pub fn new( repository: Repository, decider: Decider<'a, C, S, E, Error>, saga: Saga<'a, E, C>, ) -> Self
Creates a new instance of EventSourcedAggregate.
Sourcepub async fn handle(&self, command: &C) -> Result<Vec<(E, Version)>, Error>where
E: Identifier,
C: Identifier,
pub async fn handle(&self, command: &C) -> Result<Vec<(E, Version)>, Error>where
E: Identifier,
C: Identifier,
Handles the command by fetching the events from the repository, computing new events based on the current events and the command, and saving the new events to the repository.
Trait Implementations§
Source§impl<C, S, E, Repository, Version, Error> EventRepository<C, E, Version, Error> for EventSourcedOrchestratingAggregate<'_, C, S, E, Repository, Version, Error>
impl<C, S, E, Repository, Version, Error> EventRepository<C, E, Version, Error> for EventSourcedOrchestratingAggregate<'_, C, S, E, Repository, Version, Error>
Source§async fn fetch_events(&self, command: &C) -> Result<Vec<(E, Version)>, Error>
async fn fetch_events(&self, command: &C) -> Result<Vec<(E, Version)>, Error>
Fetches current events, based on the command.
Auto Trait Implementations§
impl<'a, C, S, E, Repository, Version, Error> Freeze for EventSourcedOrchestratingAggregate<'a, C, S, E, Repository, Version, Error>where
Repository: Freeze,
impl<'a, C, S, E, Repository, Version, Error> !RefUnwindSafe for EventSourcedOrchestratingAggregate<'a, C, S, E, Repository, Version, Error>
impl<'a, C, S, E, Repository, Version, Error> Send for EventSourcedOrchestratingAggregate<'a, C, S, E, Repository, Version, Error>
impl<'a, C, S, E, Repository, Version, Error> Sync for EventSourcedOrchestratingAggregate<'a, C, S, E, Repository, Version, Error>
impl<'a, C, S, E, Repository, Version, Error> Unpin for EventSourcedOrchestratingAggregate<'a, C, S, E, Repository, Version, Error>
impl<'a, C, S, E, Repository, Version, Error> !UnwindSafe for EventSourcedOrchestratingAggregate<'a, C, S, E, Repository, Version, Error>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more