According to the Spring documentation, when returning a Flux, Spring should emit a server-sent event for each element returned by the subscription. Here’s an exemplaric REST controller: Example response, using wget: When debugging the endpoint using Chrome or Postman, the clients seem to interpret the events as parts of a chunked response – not as a stream of events. I
Tag: project-reactor
What does timeout operator measure exactly for a Mono chain in Reactor and Webflux?
i’m using Spring Webflux and trying to understand the timeout concept for a chain of Monos. For example, there’s a chain of Mono calls: How is timeout going to be applied: 1) For the operations in general (sum time of operations) 2) For ech operation (each operation should take no longer than timeout) 3) Only for the last operation (nOperation)
How to extract string from Mono in reactor core
I have a Mono<String> object in reactor. How can I get a string value from this object? I know I can do something like below : For Mono<String> userName, I can do, But this will directly print the value. I want to store this string value into another variable so that I can pass that variable around to some other
Making multiple requests with Spring WebClient
So my goal is to use WebClient to make multiple concurrent requests, wait until they’re all completed, then combine the results. Here is what I have so far: Basically my goal is to combine all the items from each of the feeds to create one unified feed. However, I am not quite sure what to do after the call to
Mono vs CompletableFuture
CompletableFuture executes a task on a separate thread ( uses a thread-pool ) and provides a callback function. Let’s say I have an API call in a CompletableFuture. Is that an API call blocking? Would the thread be blocked till it does not get a response from the API? ( I know main thread/tomcat thread will be non-blocking, but what
Mono.subscriberContext() returning old context
I have a class PublishContext with a method context() as follows : In above code, context object is Context0@744 and context1 is Context@747 which is understandable since context is immutable and always returns a new context. In my main class, I have the following code : Here, I am getting context as Context0@744, i.e Old context and hence, getting “context