Questions tagged [spring-webflux]

Spring Framework 5 includes a new spring-webflux module. The module contains support for reactive HTTP and WebSocket clients as well as for reactive server web applications including REST, HTML browser, and WebSocket style interactions. WebFlux can run on Servlet containers with support for the Servlet 3.1 non-blocking I/O API as well as on other async runtimes such as Netty and Undertow.

Questions tagged spring-webflux should be about applications using the Spring WebFlux framework.

If Spring Boot is involved, please also tag the question with spring-boot. If the question is related to the use of Reactor operators, please tag the question with project-reactor as well.

For Spring WebFlux related documentation, please refer to the:

6050 questions
2
votes
1 answer

Is there a static way to get the current ServerHttpRequest in Spring Webflux?

Similar to Is there a static way to get the current HttpServletRequest in Spring, I want to get ServerHttpRequest in my spring webflux project via a static method, so i don't need to pass it across multiple layers all the way from controller. What's…
Ravi Soni
  • 953
  • 1
  • 7
  • 17
2
votes
1 answer

Spring WebFlux using RSocket: Kotlin coroutines Flow vs Reactor Flux message format

Is there any difference in IO traffic when we use Spring WebFlux's RSocket (over WebSockets) support to emit values using Kotlin Coroutines Flow and Reactor Flux? @MessageMapping("stream") suspend fun send(): kotlinx.coroutines.flow.Flow
Peter
  • 1,512
  • 1
  • 22
  • 40
2
votes
2 answers

Java WebFlux/Reactor - Filter a Flux> with items only found in Mono>

I'm new to WebFlux/Reactor and having trouble wrapping my head around how to write this piece of code. Basically, I have a Flux which has a nested List foo and a Mono bar and I'd like to only return items in foo that are contained in bar. //…
MannfromReno
  • 1,276
  • 1
  • 14
  • 32
2
votes
0 answers

updateTime column default is not working with Spring Webflux and H2 R2DBC

Using Spring webflux with H2-R2DBC and creating a course by adding the details in course table defined as below. CREATE TABLE IF NOT EXISTS course( id VARCHAR(40) PRIMARY KEY, name VARCHAR(40) NOT NULL, fee DECIMAL, updatedtime TIMESTAMP DEFAULT…
2
votes
1 answer

Disable automatic registration of WebFilter

In a spring-boot 2.4 application, I have two SecurityWebFilterChains. For only one of them, I want to add some WebFilters via addFilterBefore(). @Configuration @EnableWebFluxSecurity class WebSecurityConfig { @Bean fun filter1(service:…
Rüdiger Schulz
  • 2,588
  • 3
  • 27
  • 43
2
votes
0 answers

Webflux and Resilience4j retry issue

wanted to ask a basic question about webflux and resilience4j's retry. We are running Java SpringBoot with Webflux and Resilience4J (not Spring Cloud Circuit Breaker). While running the application its giving error (Somehow full stack trace is not…
2
votes
0 answers

Spring WebClient, Parallel calls to same service, collect successes and errors for response

EDIT: The core issue to this is handling errors from the Mono and converting to a new object type so I can later map as needed. Right now any unhandled errors will stop the stream. If I use onErrorReturn, then I must return the original response…
Steve W
  • 81
  • 5
2
votes
1 answer

Spring Boot WebFlux Not Working Request Controller

I wrote a rest api using webflux and I used liquebase in this project, but when I sent the project calisdirib request at the end, I saw that the controller did not work. I can't find the problem. What the problem ? When I query using locahost, it…
2
votes
1 answer

In Project Reactor, what is a "target" Mono/Flux?

eg, the Mono#transform method docs say the following: Transform this Mono in order to generate a target Mono What does "target Mono" mean?
David
  • 197
  • 7
2
votes
1 answer

How do I compare the values in 'Mono'?

Comparing the values in Mono a and Mono b, if the value in Mono a is larger, I want to throw an error. Mono a = getA(); Mono b = getB(); if(a > b) { throw new RuntimeException(); }
HooMin.Lee
  • 115
  • 1
  • 8
2
votes
0 answers

Spring reactor - trigger method with delay without waiting for the results

In my spring webflux I want to create a method mainFlow() which returns email address from the getToAddress() method. Each time someone executes the mainFlow() I want it to trigger execution of the method sendEmail() with 5 seconds delay. I don't…
Clyde Barrow
  • 1,924
  • 8
  • 30
  • 60
2
votes
1 answer

Send multiple Fluxes with different types in one response

If I have code like so: data class Response( val a: String, val b: List, val c: Int, ) fun buildResponse(): Response { val a: Mono = getA() val b: Flux = getB() val c: Mono = getC() return Response( a…
orirab
  • 2,915
  • 1
  • 24
  • 48
2
votes
1 answer

webflux netty with or without hyperthreading

I created simple Webflux (kotlin) app with reactive mongo. Controller has one GET method which is return Flow (2 objects from one collection). I used Apache Benchmark and I noticed one thing: I have i7 10700 (8+8 cores). If I set…
FoxNet
  • 518
  • 5
  • 17
2
votes
2 answers

WebClient - how to ignore a specific HTTP error

I'd like to create a Spring WebClient that ignores a specific HTTP error. From the documentation of WebClient.retrieve(): By default, 4xx and 5xx responses result in a WebClientResponseException. To customize error handling, use…
Gbr
  • 53
  • 1
  • 8
2
votes
1 answer

How to access response body in spring WebClient Retry?

I have a WebClient that makes use of retries: webClient.retryWhen( Retry.backoff(3, Duration.ofSeconds(3)).filter(this::isRetryable) ) private boolean isRetryable(Throwable throwable) { //TODO how access the json body? } Question: how can I…
membersound
  • 81,582
  • 193
  • 585
  • 1,120