Skip to content

[#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
merged 7 commits into from
Apr 22, 2025

Conversation

smcvb
Copy link
Member

@smcvb smcvb commented Apr 17, 2025

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 a ThreadLocal.
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 a ThreadLocal and (2) invokes all interceptors and the final handler, is the ChainedMessageHandlerInterceptorMember.

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 the AnnotatedHandlerInspector.
This allowed me to reuse the ChainedMessageHandlerInterceptorMember inside the ChildForwardingCommandMessageHandlingMember.

By doing so, I aligned the interceptor behavior for aggregate and child entities (also called aggregate members).
This resolves issue #3385.

smcvb added 6 commits April 17, 2025 17:29
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
@smcvb smcvb added Type: Bug Use to signal issues that describe a bug within the system. Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. labels Apr 17, 2025
@smcvb smcvb added this to the Release 4.11.2 milestone Apr 17, 2025
@smcvb smcvb requested a review from a team April 17, 2025 15:43
@smcvb smcvb self-assigned this Apr 17, 2025
@smcvb smcvb requested review from abuijze, CodeDrivenMitch and MateuszNaKodach and removed request for a team April 17, 2025 15:43
@smcvb smcvb enabled auto-merge April 18, 2025 15:04
@smcvb smcvb disabled auto-merge April 18, 2025 15:04
Copy link
Member

@CodeDrivenMitch CodeDrivenMitch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@smcvb smcvb enabled auto-merge April 22, 2025 07:39
@smcvb smcvb disabled auto-merge April 22, 2025 07:39
@smcvb smcvb merged commit 184c53f into axon-4.11.x Apr 22, 2025
5 of 7 checks passed
@smcvb smcvb deleted the bug/3385/interceptor-chain-not-found branch April 23, 2025 14:09
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy