10 Consistency Patterns
This chapter details patterns that help to ensure consistency in distributed systems.
The Transaction-Based Processor in § 10.1 expands well-known database transaction to message processing
The Transactional Outbox in § 10.2 ensures messages are sent if a database is updated
The Saga pattern in § 10.3 shows a way how to manage distributed transactions, a notoriously difficult problem. It has two possible implementations:
The Event Sourcing pattern in § 10.6, a well-known pattern that can also be used to simplify consistency in an event-driven architecture
Other patterns that could be considered a part of this category include:
- Queue-Based Load Levelling which can be used to achieve guaranteed delivery of messages
- Publisher–Subscriber to facilitate data replication when using event sourcing
- Leader and Followers which is commonly used in data replication [5, p. 85]
- Command and Query Responsibility Segregation (CQRS) which can be used to implement event sourcing, but also to introduce eventual consistency
Notable omissions in this category due to the methodology described in § 1 include:
Data Abstractor by Fehling et al. [15, p. 194], which is not mentioned by any other authors
Command-side replica by Richardson [146] for the same reason
Domain Event by Richardson [20, p. 160] as it does not pertain to architecture