feat(eventsourcing): EntityModule (DCB) enables different EventCritera for sourcing (loading events) and appending (consistency checking)#4125
Draft
MateuszNaKodach wants to merge 10 commits intomainfrom
Draft
Conversation
…ia for sourcing (loading events) and appending (consistency checking) - New annotations: @SourceCriteriaBuilder and @AppendCriteriaBuilder for separate criteria - EventStore interface: Added transaction(AppendCondition, ProcessingContext) method - EventSourcingRepository: Now supports two separate CriteriaResolver fields - AnnotationBasedCriteriaResolvers: Factory class that creates both resolvers with proper annotation precedence - Configuration modules: Updated to support criteriaResolvers(source, append) method
…nd corresponding command
MateuszNaKodach
commented
Jan 19, 2026
| * @see #transaction(ProcessingContext) for default behavior where append criteria | ||
| * is derived from source criteria | ||
| */ | ||
| EventStoreTransaction transaction(@Nullable AppendCondition appendCondition, |
Contributor
Author
There was a problem hiding this comment.
Do you expect here AppendConition or just EventCriteria for appendConidtion? If we calculate the marker from sourced events, I think there should be just EventCriteria, what do you think?
…gineBackedEventStoreTestSuite
…pendCriteriaBuilder` annotations
|
…`EventCriteria`in `transaction` method
…ngine` implementations - Introduced `consistencyMarker(TrackingToken)` method to bridge tracking tokens with consistency markers. - Updated all `EventStorageEngine` implementations (`Jpa`, `InMemory`, `AxonServer`) to provide respective conversion logic. - Added JavaDoc to `EventStorageEngine` interface detailing the method's purpose and usage.
…ultEventStoreTransaction` - Added logic to handle standalone append criteria without sourcing, resolving markers from the latest token. - Introduced `resolveAppendCondition` method for consistent and efficient marker resolution.
… in tests and allow nullable `sourceCriteriaResolver` - Updated test assertions to verify `transaction` calls with `EventCriteria` and `ProcessingContext`. - Made `sourceCriteriaResolver` nullable to enable standalone append scenarios without event sourcing.
…dd `appendCriteriaResolver` support in `EntityModule` - Introduced `appendCriteriaResolver` to handle scenarios without event sourcing. - Updated validation and component registration to accommodate nullable `sourceCriteriaResolver`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Annotation Precedence Rules
For Sourcing:
@SourceCriteriaBuilderpresent -> use it@EventCriteriaBuilderpresent -> use itFor Appending:
@AppendCriteriaBuilderpresent -> use it@EventCriteriaBuilderpresent -> use itNote:
@AppendCriteriaBuilderis allowed standalone (uses tag-based fallback for sourcing).