[#3385] Align interceptor behavior for Aggregate Members #3404
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.