-
Notifications
You must be signed in to change notification settings - Fork 5.1k
CAMEL-22717: camel-mdc - MDC is lost when using interceptSendToEndpoi… #20247
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
base: main
Are you sure you want to change the base?
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🤖 CI automation will test this PR automatically. 🐫 Apache Camel Committers, please review the following items:
|
…nt (and potentially other situations)
…nt (and potentially other situations)
…nt (and potentially other situations)
…nt (and potentially other situations)
…nt (and potentially other situations)
…nt (and potentially other situations)
…nt (and potentially other situations)
squakez
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.
I don't have a deep knowledge of the core architecture. However I think this may become inconsistent under certain situations given that we always set the MDC but we are not 100% sure we unset it (as it happens elsewhere). IMO a more consistent solution would be to understand how the "intercept" works and make it able to be wrapped by any InterceptStrategy provided.
This very same problem is probably happening with customers' own strategies and possibly with other components that have a similar behavior of the MDC (eg, the telemetry ones). So, even if we "patch" it with this PR, the root cause will still exists.
I had planned to had another look soonish in order to understand how to make the interception (and others feature) part of the wrapped execution of any InterceptStrategy, so I had this Jira parked. If we're not in a rush, you can keep this on hold and I will try to analyse any alternative to understand a more consistent design if it is doable or not.
|
On top of that, this would defeat the intent of design change we introduced to make the set/unset logic transactional: https://github.com/apache/camel/blob/main/proposals/mdc.adoc#proposal |
|
For transacted then its not a problem as it will be forced executed on the same thread, and unset is not needed. Its also better to not unset as then the MDC values are still present if 3rd party frameworks does logging. About custom intercept strategy then its not the goal to have such hard-core feature as something that just snap in. Camel is a old framework and some part have their own pros/cons. |
…nt (and potentially other situations)
Description
Target
mainbranch)Tracking
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.