I am calling a post endpoint that returns a Void. I am trying to get the time elapsed. It seems it is not calling an endpoint. doOnSuccess is also not getting called. Answer elapsed() measures the time between when the Mono is subscribed to and the moment the Mono emits an item. But, Mono<Void> response…
Tag: project-reactor
Process List with synchronous delay after flatMap?
Hey I just started to dive into reactive programming and I can’t figure out how to process a List<String> in a synchronous way after flatMap. What I am trying to achieve: Get domain list from external service Filter out existing domains in database Make another http request to external service to …
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 impl…
Convert Flux into Flux
I am working on spring webflux file upload. From the controller I want to upload the file on amazon S3 bucket. So in the controller I received following object And from the FilePart.content() I can get My question is how can I convert this Flux<DataBuffer> into Flux<ByteBuffer>. I mean into the fo…
Reactive – Improve Mono syntax
I have this block of code that works fine: To summarize it: calls the isBlacklistedToken function (returns a Mono<Boolean> with the result of the refresh token) If the refresh token is blacklisted, throws an UnauthorizedException If the refresh token is not blacklisted, does the same process for the acc…
How to limit concurrent http requests with Mono & Flux
I want to handle Flux to limit concurrent HTTP requests made by List of Mono. When some requests are done (received responses), then service requests another until the total count of waiting requests is 15. A single request returns a list and triggers another request depending on the result. At this point, I …
How to chain operations with side effects?
I have two methods that allows to get an access to underlying storage in async manner I want to create another async method that will read value and delete it immediately with returning of read value. I was able to manage it in a really ugly way. But I’m sure more elegant and correct way to do it have t…
ReactiveCrudRepository vs. R2dbcRepository
I am learning the reactive stack starting with R2DBC and this is what I don’t understand: What are the differences between these, when to use them, and how relevant the @Repository stereotype annotation is to them? org.springframework.data.r2dbc.repository.R2dbcRepository org.springframework.data.reposi…
Update objects’s state in Reactor
Given the following method: switchIfEmpty and map operators mutate the profileUpdate object. Is it safe to mutate in switchIfEmpty operator? Regarding map, if I have understood correctly, this is not safe and object profileUpdate must be immutable, right? eg: Later in the chain, another method mutates the obj…
How to convert Flux<List> into Mono<List>
I have a service which returns Flux<List<Integer>> and I would like to convert it into Mono<List<Integer>> to be used inside transform() Here is what I did by using flatMap and Mono.just(): But what I would like is to use transform instead: Is there any operator or technique to make me…