Persisting aggregates
When working with any system of even moderate complexity, we are required to make interactions durable; that is, interactions need to outlast system restarts, crashes, and so on. So the need for persistence is a given. While we should always endeavor to abstract persistence concerns from the rest of the system, our persistence technology choices can have a significant impact on the way we architect our overall solution. We have a couple of choices in terms of how we choose to persist aggregate state that are worth mentioning:
- State-stored
- Event-sourced
Let’s examine each of these techniques in more detail in the following sections.
State-stored aggregates
Saving current values of entities is by far the most popular way to persist state – thanks to the immense popularity of relational databases and Object-Relational Mapping (ORM) tools such as Hibernate. And there is good reason for this ubiquity. Until recently, a majority...