Published July 13, 2026 | Version v5

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.

 

Notes

The author utilized Gemini 3.5 Flash for stylistic revision and text optimization of this manuscript, as stated in the Acknowledgments

Notes

This paper is open to community peer-review and feedback. If you wish to submit comments or suggestions, feel free to open an Issue or a Discussion on the project's GitHub repository https://github.com/tonyx/Sharpino

Files

Dynamic_Consistency_Boundaries_in_event_sourcing_via_multi_stream_optimistic_lock_control_en_05.pdf

Additional details

Software

Repository URL
https://github.com/tonyx/Sharpino
Programming language
F#
Development Status
Active