-
Notifications
You must be signed in to change notification settings - Fork 61
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
Context propagation not working in async calls #947
Comments
Thanks for the precise analysis and reproducer, @AndreasPetersen! I added the reproducer and I tried to fix the issue in #950 I thought it would be enough to instruct CXF to submit the async client requests through
and in the stack trace, there is
but it is still failing with the following stack trace:
@cescoffier @geoand @mkouba would you mind looking at the second commit in #950 and give any hints what is missing? |
OK, so, in my opinion, what happens here is that you're not capturing the context of when you create the Context Propagation is supposed to happen by capturing the context when it's set up, saving it for later, and then restoring it when it's no longer there (in another thread, for example). You're using Does this help? |
Thanks a lot @FroMage! I needed exactly this kind of conceptual intro. Let me try your hint with |
This was indeed crucial for me: I found out that the runnable is created in HC5's own event loop thread where the context is not available, so submitting the response consumer runnable to ManagedExecutor was not enough. I was able hack into CXF internals and (indirectly) wrap the runnable from the Vert.x event loop where the context is available. I hope that's the right thing to do.
I had to keep using ManagedExecutor because otherwise CXF would use its own executor and with that one in place, the scenario was failing. Thanks again, @FroMage, the context propagation part is clear. Now I can turn to CXF experts to figure out how to make my hack more elegant. |
OK, great :) Glad that it was this and not something hard to find :) |
from metrics, related to quarkiverse#947
When using HTTP Async Transport context propagation is not made when using quarkus-smallrye-context-propagation. This is in contrast to async REST requests, where the context is correctly propagated.
I have created a reproducer project here. In it, you will find a test which calls an HTTP server REST endpoint, which makes a call to:
I'm using the Micrometer metrics feature with Quarkus CXF , and I've created a
MeterFilter
that adds tags to the created metrics from a@RequestScope
d bean. However, since the no context propagation is done on the async SOAP client call, theMeterFilter
fails with:The text was updated successfully, but these errors were encountered: