I’m quite new in the reactive world My code looks like this: The result is of type Map<String, Mono<String>> . I would like it to be of type Map<String, String>. Any ideas? Answer I suggest to use flatMap operator before collecting the elements into a Map
Tag: project-reactor
How to emit filtered out error if flux is empty
I have synchronous code that I want to make non-blocking with reactor. I want to call in parallel different URI, the calls can return a response, an error or nothing. There are 3 cases: A request returns a response, I return it without waiting for the other requests to complete. If other requests returned errors earlier, I drop the errors
How to consume infinite flux multiple times
This is what I’m trying to achieve: When somebody requests http://localhost/runIt, I would like to return data from cache that would be refreshed every 6 seconds. Below, I have a flux (always same one that is stored in map) that is first time instantiated and starts emitting numbers 0,1,2,3,4… to infinity. Is it possible to make this Spring MVC Controller
Building a Recursive Data Structure with Spring WebFlux
I have a REST API that is built with the Spring WebFlux framework, and I have an endpoint which returns a Flux<ChannelResponse>, where ChannelResponse is a tree-structured object, as shown below: Now, I don’t have much experience with the reactive programming paradigm, but this is how I would implement such an endpoint with synchronous logic, such that each top-level channel
Reduce a flux to mono using data from flux
I have this scenario. I have one paginated API which gives me the data for last 12 months. The response of the API is like: public class PagedTransfersDto { private List
Is Reactor chain still running
I have an application based on Spring WebFlux and Reactor. Application starts everyday on a schedule and loads statistics. But there is also available a manual launch option through controller. So if …
Java reactor how to properly start async cancellable sideeffect
I’m trying to write something using reactor which I know how to write using completable futures. I’m getting “Calling subscribe in non-blocking scope” warning in it. My goal is to call …
How to create a generic wrapper for just any method call?
I want to create a helper method that can wrap/convert just any sync method call into an async Mono. The following is close, but shows an error: Required type: Mono Provided: Mono<? …
Continue consuming subsequent records in reactor kafka after deserialization exception
I am using reactor kafka and have a custom AvroDeserializer class for deserialization of messages. Now I have a case where for certain payloads the deserialization class throws an exception. My Kafka …
How to handle file access in a reactive environment
I’m refactoring some blocking code to reactive (using Reactor). I think most of the methods in the java.nio.file.Files class are blocking. Is it right if I replace a method like: public boolean exists(…