camel icon indicating copy to clipboard operation
camel copied to clipboard

CAMEL-22717: camel-mdc - MDC is lost when using interceptSendToEndpoi…

Open davsclaus opened this issue 3 weeks ago • 3 comments

…nt (and potentially other situations)

Description

Target

  • [ ] I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • [ ] If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • [ ] I checked that each commit in the pull request has a meaningful subject line and body.
  • [ ] I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

davsclaus avatar Dec 05 '25 20:12 davsclaus

:star2: Thank you for your contribution to the Apache Camel project! :star2:

:robot: CI automation will test this PR automatically.

:camel: Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • :warning: Be careful when sharing logs. Review their contents before sharing them publicly.

github-actions[bot] avatar Dec 05 '25 20:12 github-actions[bot]

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

squakez avatar Dec 09 '25 09:12 squakez

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.

davsclaus avatar Dec 09 '25 10:12 davsclaus