March 2025
Intermediate to advanced
202 pages
4h 45m
English
In this chapter, you’ve actually been building what Martin Fowler[7] calls an aggregate without labeling it as such. At a conceptual level, an aggregate is a single, uniquely identifiable entity that has state, validates commands, and emits events.
Every aggregate must have a unique identifier or key. This differentiates one aggregate from another within the same event stream. By way of example, consider a group or a class called BankAccount. Given a stream of ledger events, the key that differentiates one aggregate from another might be the key field account_number. In this case, you can say that there’s an aggregate type called BankAccount, and one aggregate (or aggregate instance, depending on where ...
Read now
Unlock full access