-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Propagate context to message converters when streaming with Flux in Spring MVC #32813
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
Comments
Those are related issues but not the same. It means after the changes, the following works: @GetMapping(path = "/", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<Greeting> stream() {
return Flux.interval(Duration.ofSeconds(1))
.doOnNext(o -> {
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
System.out.println("RequestAttributes: " + attributes);
})
.map(value -> new Greeting("bar"));
} When Spring MVC subscribes to the The |
I'm not sure I follow yet - isn't the subscriber Spring MVC, which you said would propagate the context? By "works" you mean "prints out request attributes", I guess, but that's not helpful if the |
@dsyer this should work now. Please, give it another try. |
Uh oh!
There was an error while loading. Please reload this page.
#32296 and #32112 are now closed but the sample that I was interested in is still broken (see link in the latter): the
RequestContextHolder
is still empty in anHttpMessageConverter
being used to render aFlux
as aMediaType.TEXT_EVENT_STREAM
.The text was updated successfully, but these errors were encountered: