Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait AggregateRoot[AR <: AggregateRoot[AR, Event], Event] extends EventSourced[AR, Event] {
- def uncommittedEvents: List[Event]
- def markCommitted: AR
- }
- trait AggregateFactory[AR <: AggregateRoot[AR, Event], Event] extends EventSourced[AR, Event] {
- def loadFromHistory(history: Iterable[Event]): AR = {
- var aggregate = applyEvent(history.head)
- for (event <- history.tail)
- aggregate = aggregate.applyEvent(event)
- return aggregate.markCommitted
- }
- }
Add Comment
Please, Sign In to add comment