-
Notifications
You must be signed in to change notification settings - Fork 805
[#3385] Align interceptor behavior for Aggregate Members #3404
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
Merged
+152
−64
Conversation
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
Add testing validating member-only interceptor support #3385
Add InterceptorChain to align with sample. This breaks the test #3385
Extract ChainedMessageHandlerInterceptorMember, as it's required in the ChildForwardingCommandMessageHandlingMember for reuse #3385
Adjust interceptor behavior for child entities. Instead of preemptively checking the matching interceptors, simply push all interceptors into a ChainedMessageHandlerInterceptorMember. Doing so, we ensure the InterceptorChain is present as a ThreadLocal, allowing the InterceptorChainParameterResolver to inject it on time. If there are no interceptors, use the NoMoreInterceptors instance. This shifts makes it so that child entities behave the same as the parent aggregate when it comes to interceptor behavior. #3385
Remove use of final modifier #3385
Fix undesired indenting change #3385
abuijze
approved these changes
Apr 18, 2025
CodeDrivenMitch
approved these changes
Apr 21, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Priority 1: Must
Highest priority. A release cannot be made if this issue isn’t resolved.
Type: Bug
Use to signal issues that describe a bug within the system.
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.
The
ChildForwardingCommandMessageHandlingMember
followed a different paradigm for deciding which Annotated Message Handler Interceptors to pick.More specifically, it checked if the interceptors match with the message that's being handled.
Although not inherently wrong, if somebody used the
InterceptorChain
parameter, it would simply fail.This failure stems from the way we set the
InterceptorChain
for parameter resolution. Namely, on aThreadLocal
.For this process to succeed, we first want to invoke the chain before validating if the message can be handled.
The component that ensure that (1) the
InterceptorChain
is present on aThreadLocal
and (2) invokes all interceptors and the final handler, is theChainedMessageHandlerInterceptorMember
.Hence, the old behavior made it so that aggregates with aggregate members, with interceptors ONLY on those aggregate members, didn't have their interceptors invoked IF those included the
InterceptorChain
parameter.To resolve this, I moved the
ChainedMessageHandlerInterceptorMember
out of theAnnotatedHandlerInspector
.This allowed me to reuse the
ChainedMessageHandlerInterceptorMember
inside theChildForwardingCommandMessageHandlingMember
.By doing so, I aligned the interceptor behavior for aggregate and child entities (also called aggregate members).
This resolves issue #3385.