@ThreadContextConfig does not work in Quarkus
See original GitHub issueDescribe the bug
While it is documented in https://quarkus.io/guides/context-propagation annotating
@Inject
@ThreadContextConfg(cleared = [ ... ])
ThreadContext threadContext;
does not work - the annotation seems to be ignored and all context is propagated.
Expected behavior
This annotation should work as documented in the guide https://quarkus.io/guides/context-propagation , e.g. not propagate transaction context when this is supposed to be cleared.
Actual behavior
All contexts are propagated.
How to Reproduce?
No response
Output of uname -a
or ver
No response
Output of java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.3.0.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
Workaround exists:
SmallRyeContextManagerProvider.getManager().newThreadContextBuilder()
.propagated(ThreadContext.CDI, "JAX-RS", "Servlet").cleared(ThreadContext.TRANSACTION).build();
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Context Propagation in Quarkus
Using configuration ; mp.context.ThreadContext.cleared. The comma-separated set of cleared contexts. None (no context), unless neither the propagated nor cleared ...
Read more >Manual context propagation in Quarkus native mode
One possible issue with this is that whatever changes you do to MDC on the new thread will not be propagated back to...
Read more >Context Propagation in Quarkus
It works by capturing those contextual values that used to be in thread-locals, and restoring them when your code is called. Setting it...
Read more >Configuring Log4j 2 - Apache Logging Services
This won't work for elements such as appenders and filters, where each element has a different name in the concise format. Appenders and...
Read more >Structured logging in Spring Boot with Log4j2, Part 1 - Medium
For logs to be useful when debugging thorny issues, context is crucial ... but also for other newer Java frameworks like Quarkus and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mkouba I created area/context-propagation . I’ll let you add the rules you want here: https://github.com/quarkusio/quarkus/blob/main/.github/quarkus-bot.yml . Even if you don’t add a pattern for the title, it’s still useful to have the bot ping the appropriate persons when we add the label and remove the needs-triage one.
I will look into implementing this I also stumled upon a very old issue where we apparently already knew this was missing but it got lost - https://github.com/quarkusio/quarkus/issues/6156