Skip to content

Conversation

@squakez
Copy link
Contributor

@squakez squakez commented Dec 17, 2025

  • Added a stack based MDC push/pop, by storing temporary the context before the exchange execution and setting back after it.
  • We cannot reliably clean the context at the end of the async execution as other processes (eg, InterceptSendToEndpoint EIP) could need to use the context previously set. In any case, this is not a consistency break, as, by design, we always reset the MDC context before any execution (either sync or async).
  • The only side effect is that the unit tests cannot check any longer that there is no MDC context as, this will be maintained (as required by those EIP mentioned earlier).

Closes CAMEL-22717

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.

* Added a stack based MDC push/pop, by storing temporary the context before the exchange execution and setting back after it.
* Removed the check of no MDC after test execution. This is due to the fact that we cannot reliably clean the context as other async processes (eg, InterceptSendToEndpoint EIP) could need to use the context previously set. In any case, this is not a consistency break, as, by design, we always reset the MDC context before any execution (either sync or async).
* The only side effect is that the unit tests cannot check any longer that there is no MDC context as, this will be maintained (as required by those EIP mentioned earlier).

Closes CAMEL-22717
@github-actions
Copy link
Contributor

🌟 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:

  • 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.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@squakez
Copy link
Contributor Author

squakez commented Dec 17, 2025

@Croway thanks for the review comment, now the tests are much more idiomatic, please, have a look.

@squakez squakez marked this pull request as draft December 17, 2025 14:38
@squakez
Copy link
Contributor Author

squakez commented Dec 17, 2025

To cherrypick the other PRs doc and unit test developed.

@squakez squakez marked this pull request as ready for review December 17, 2025 16:57
@squakez squakez merged commit f0a803a into apache:main Dec 17, 2025
5 checks passed
@squakez squakez deleted the fix/CAMEL-22717_2 branch December 17, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants