quarkus: Header Propagation does not work when using Asynchronous Rest Clients
Describe the bug
Rest Client Header Propagation does not work when using Asynchronous Rest Clients. I have created a small sample which reproduces the problem with Quarkus 0.23.2, with both CompletionStage
and Single
Expected behavior
When using Single
or CompletionStage
in the REST clients’ responses, it seems that the header propagation does not work.
Actual behavior
when HeaderPropagator
is called, the container request headers are empty.
To Reproduce Steps to reproduce the behavior:
- Open the attached project and run it. Put a breakpoint inside the
HeaderPropagator
- GET
http://0.0.0.0:8080/hello
. The breakpoint will get hit, thecontainerRequestHeaders
will be full of your browser’s headers. - GET
http://0.0.0.0:8080/hello/async
orhttp://0.0.0.0:8080/hello/single
. The same array will be empty.
I have also included all necessary libraries as instructred here https://quarkus.io/guides/context-propagation-guide and had the same results. Header propagation only works in synchronous mode.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 47 (39 by maintainers)
Sorry to jump in, but I would like to clarify that my original comment and report concerned the non-reactive rest client (there was no reactive resteasy back then), and the usage of
ClientHeadersFactory
, which is the “proper” way of doing header propagation (get headers from the incoming request, and put them in the outbound requests from the microservice). Now we also have the same for RestEasy Reactive - https://quarkus.io/guides/rest-client-reactive#custom-headers-supportThis seems to be a different issue, @jdussouillez , unless I am mistaken.
Also, from what I can understand, the
respContext.getHeaderString(HttpHeaders.CONTENT_ENCODING);
will return the response headers from the server that gave the response to the rest-client’s HTTP request, which may not have something to do with the headers of the incoming request to the microservice.@geoand I will work on this and try to provide you the smallest project to reproduce next week.