-
Notifications
You must be signed in to change notification settings - Fork 12
Add cleaning of EntityContext to EEntity
#581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #581 +/- ##
============================================
+ Coverage 92.74% 92.76% +0.01%
- Complexity 2693 2697 +4
============================================
Files 326 326
Lines 9290 9311 +21
Branches 615 616 +1
============================================
+ Hits 8616 8637 +21
Misses 494 494
Partials 180 180 |
alexander-yevsyukov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comments.
| eventStore.append(enriched); | ||
| final MemoizingObserver<Event> observer = memoizingObserver(); | ||
| eventStore.read(EventStreamQuery.getDefaultInstance(), observer); | ||
| final RejectionContext modifiedOrigin = observer.responses() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did you mean by modifiedOrigin? This question applies to this variable and similar below.
| final EventContext.Builder resultContext = context.toBuilder() | ||
| .clearEnrichment(); | ||
| final EventContext originEventContext = context.getEventContext(); | ||
| if (!isDefault(originEventContext)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use case detection API from Protobuf.
alexander-yevsyukov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
alexander-yevsyukov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have default statement with ISE.
alexander-yevsyukov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comments.
| // Does nothing because the origins is `null`. | ||
| break; | ||
| default: | ||
| throw newIllegalStateException("Not all of `OriginCase` values were handled."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have the message which says something like “Unsupported origin case encountered: %s”.
| break; | ||
| case ORIGIN_NOT_SET: | ||
| throw newIllegalStateException("EventContext.origin should be set."); | ||
| // Does nothing because the origins is `null`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protofub doesn't have nulls. This comment is misleading.
alexander-yevsyukov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR fixes work of
EventStore. Before,EventStorestored redundant data such as enrichments.Such a behavior could cause performance issues, especially after addition of
Reactannotation.Because
EventContext.originmay contain anotherEventContextand so on and so on. And everyEventContextmay contain information aboutEnrichmentof an event.So from now,
EEntitydoesn't contain data about the enrichment of the event (which the entity represents), enrichment of the origin (if the origin isEventContextorRejectionContext) and nested origins.