Latest Questions tagged Project Reactor

Browse all latest questions tagged Project Reactor

Published 26 Oct, 2022
Java - How to merge two execute two reactor fluxes in parallel that return lists and merge the results

I have a LegacyAccountDto that I need to build a list of from two separate sources. One is a local JPA repository and the other is a web service call. The web service version has the accountStatus a...

Published 20 Aug, 2022
Java - How to include if-else statements into reactive flow

I have a Spring Webflux reactive service which receives a DTO and inserts it into multiple table. Sometimes we may need to skip inserting into some tables based on the incoming DTO. These are the requ...

Published 02 Sep, 2022
Java - How to extract string from Mono<String> in reactor core

I have a Mono&lt;String&gt; object in reactor. How can I get a string value from this object? I know I can do something like below : For Mono&lt;String&gt; userName, I can do,

Published 01 Sep, 2022
Java - Correct way of throwing exceptions with Reactor

I'm new to project Reactor and reactive programming in general. I'm currently working on a piece of code similar to this: Mono.just(userId) .map(repo::findById) .map(user-&gt; { if(u...

Published 29 Aug, 2022
Java - Handling exception in WebClient throws io.netty.handler.timeout.ReadTimeoutException

So I am new to Reactive programming and I wrote some code that I would like to test. Those are more of a integration tests as I am live copying files and later check if they are the same. I have a Moc...

Published 11 Sep, 2022
Java - Project Reactor - How to handle OverflowException from Flux.interval?

I am building a spring boot application using Spring Webflux and I want to make the application fully non-blocking. The application itself has some REST endpoints and a batch job that needs to run eve...

Published 07 Sep, 2022
Java - Reactor : How to convert a Flux of entities into a Flux of DTO objects

I have a User entity and a Role entity. The fields are not important other than the fact that the User entity has a role_id field that corresponds to the id of its respective role. Since Spring Data...

Published 03 Sep, 2022
Java - WebFlux DataBufferLimitException: Part headers exceeded the memory usage limit of 8192 bytes

When uploading a csv file and a JSON object at the following endpoint @PostMapping(value = &quot;dataset/rows/query&quot;, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) Mono&lt;List&lt;Integer&gt;&g...

Published 03 Sep, 2022
Java - ReactiveSecurityContextHolder.getContext() is empty but @AuthenticationPrincipal works

I've been using ReactiveAuthenticationManager in Spring Security + Webflux. It is customised to return an instance of UsernamePasswordAuthenticationToken which from what I can tell is an what I should...

Published 03 Sep, 2022
Java - 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: ... Flux&lt;ServerResponse&gt; feedRespon...

Published 02 Sep, 2022
Java - Spring Reactor: fails on empty Mono

I am using Spring Reactor 3.1.0.M3 and have a use case where I need to merge Mono's from multiple sources. I found that if one of the Monos is an empty Mono, zip fails without an error. Example: Mo...

Published 31 Aug, 2022
Java - block()/blockFirst()/blockLast() are blocking error when calling bodyToMono AFTER exchange()

I am trying to use Webflux to stream a generated file to another location, however, if the generation of the file ran into an error, the api returns success, but with a DTO detailing the errors while...

Published 30 Aug, 2022
Java - Spring Reactor onErrorContinue not working

As per documentation I am expecting onErrorContinue will ignore the error element and continue the sequence. Below test case is failing with exception java.lang.AssertionError: expectation &quot;expe...

Published 28 Aug, 2022
Java - How to Count Items in a Flux, return error if count is greater than X, else continue with Pipeline

I'm new to Project Reactor in Spring, and I'm not fully sure how to perform something: I have my pipeline the pipeline returns records. All good. But I would like to count those records and then do...

Published 27 Aug, 2022
Java - How to set event-loop pool size in Spring Webflux / WebClient?

In multi-reactor framework such as Vert.X we can set the number of event-loop threads, e.g.: final VertxOptions vertxOptions = new VertxOptions(); vertxOptions.setEventLoopPoolSize(16); final Vertx...