Interface StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_TYPE>>
- Type Parameters:
ID- the type of idEVENT_TYPE- the type of eventAGGREGATE_TYPE- the aggregate type
- All Superinterfaces:
Aggregate<ID,AGGREGATE_TYPE>
- All Known Implementing Classes:
AggregateRoot,AggregateRoot,AggregateRootWithState
public interface StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_TYPE>>
extends Aggregate<ID,AGGREGATE_TYPE>
A stateful
What makes an
See
Aggregate is the most common form of Aggregate design in Object Oriented languages.What makes an
Aggregate stateful is the fact that any changes, i.e. Events applied as the result of calling command methods on the aggregate instance, are stored
within the StatefulAggregate prior to persisting the aggregate, and the events associated with any changes can be queried using getUncommittedChanges() and is
reset (e.g. after a transaction/UnitOfWork has completed) using markChangesAsCommitted()See
FlexAggregate for an immutable Aggregate design-
Method Summary
Modifier and TypeMethodDescriptionQuery any changes to the Aggregate, i.e.voidResets thegetUncommittedChanges()- effectively marking them as having been persisted and committed to the underlyingEventStoreMethods inherited from interface dk.cloudcreate.essentials.components.eventsourced.aggregates.Aggregate
aggregateId, eventOrderOfLastRehydratedEvent, hasBeenRehydrated, rehydrate
-
Method Details
-
getUncommittedChanges
EventsToPersist<ID,EVENT_TYPE> getUncommittedChanges()Query any changes to the Aggregate, i.e. Events applied as the result of calling command methods on the aggregate instance,- Returns:
- the changes to the aggregate
-
markChangesAsCommitted
void markChangesAsCommitted()Resets thegetUncommittedChanges()- effectively marking them as having been persisted and committed to the underlyingEventStore
-