Dynamic Consistency Boundaries in Event Sourcing via Multi-Stream Optimistic Concurrency Control
Authors/Creators
Description
In traditional Event Sourcing (ES) architectures combined with Domain-Driven Design (DDD), the Aggregate serves as the ultimate boundary of immediate consistency. However, real-world business domains frequently demand validation rules that span across multiple aggregates or depend on global dynamic contexts. Existing solutions either expand aggregate boundaries—leading to performance degradation and write contention—or rely on Process Managers, sacrificing immediate consistency in favor of eventual consistency. A third approach introduces dynamic consistency boundaries by executing time-confining conditional queries on past events at write time; however, this requires the persistence layer to evaluate domain-specific event semantics within the storage engine.
This paper introduces a novel architectural pattern for Dynamic Consistency Boundaries implemented in the functional framework Sharpino. Instead of performing conditional historical queries on event streams during commit, the proposed approach leverages evaluated non-memoizing Thunks against cached projection states of external aggregates. Immediate consistency across these dynamic boundaries is strictly enforced at the persistence layer by extending the Optimistic Concurrency Control (OCC) mechanism to encapsulate a unique, tuple-keyed map of version identifiers (EventId) belonging to all external streams consulted during the validation phase. We show that this pattern achieves strong transactional safety across arbitrary boundaries while maintaining O(1) computational complexity relative to event stream length during the validation phase.
Files
Dynamic_Consistency_Boundaris_in_eventsourcing_via_multi_stream_optmisitic_lock_control_en_01.pdf
Files
(163.5 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:818a120a6a72569e816b64d51317d10e
|
163.5 kB | Preview Download |
Additional details
Software
- Repository URL
- https://github.com/tonyx/Sharpino
- Programming language
- F#
- Development Status
- Active