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
0 answers

How to send HTTP requests in parallel

May I ask how to send HTTP requests in parallel in the context of Spring Webflux and Spring WebClient? I have a very simple scenario, where from one request, step 1, I make a first request to one external API. Step 2, from the result of the first…
PatPanda
  • 3,644
  • 9
  • 58
  • 154
2
votes
2 answers

What's the correct way to use webflux and reactor

I'm leaning webflux and reactor. Got three test methods as below. "documentOperations.findById" and "documentOperations.delete" are two database operations. I know test1 is bad as the two db operations are placed in one async method. My question is:…
2
votes
2 answers

Spring Webflux send event when any new data

I'm trying to learn Spring webflux & R2DBC. The one I try is simple use case: have a book table create an API (/books) that provides text stream and returning Flux I'm hoping when I hit /books once, keep my browser open, and any new data…
Timothy
  • 855
  • 1
  • 13
  • 29
2
votes
1 answer

How do you use Spring WebClient as a file download passthru

I am trying to use WebClient to download a file from a external service and return it to the client. In the Rest Controller, I have the following endpoint: @GetMapping(value = "/attachment/{fileId}", produces =…
Gordan Lin
  • 27
  • 1
  • 6
2
votes
1 answer

What's the purpose of applying the Bulkhead pattern on a non-blocking application?

My understanding of the Bulkhead pattern is that it's a way of isolating thread pools. Hence, interactions with different services use different thread pools: if the same thread pool is shared, one service timing out constantly might exhaust the…
Rubasace
  • 939
  • 8
  • 18
2
votes
0 answers

Exception caught by @ExceptionHandler is not recorded by MetricsWebFilter

Trying to migrate from web-mvc to webflux+coroutines. Faced a problem with http.server.requests metric recording. With web-mvc, when using @RestController, @RestControllerAdvice with multiple @ExceptionHandler, I got exception classes recorded in…
2
votes
0 answers

How To Keep Alive Spring Webflux WebSocket

I was working on spring web-flux reactive WebSocket , so I was trying to emulate a bidirectional text communication channel by which both I can send and well as receive message , I was successfully able to run a WebSocket server public Mono
user3878073
  • 81
  • 1
  • 1
  • 7
2
votes
0 answers

How to test HandlerFunction without RouterFunction in WebFlux using Functional API?

I am writing a simple HTTP server with Spring WebFlux using the Functional API in Kotlin. As the documentation says, a HandlerFuction handles incoming ServerRequests by returning a Mono on invocation. Let's assume, we have the…
2
votes
1 answer

Spring WebClient : Call method in retry

I have been looking for a solution to the following use case without success, I hope someone can help : Assuming the following use case. I need to call a customer Api (customerApi) and this api needs a Bearer token which may have expired when I call…
Pierre Jones
  • 620
  • 1
  • 11
  • 24
2
votes
1 answer

How to migrate the GlobalMethodSecurityConfiguration to Reactive Spring?

I have overridden SecurityExpressionRoot in my project exposing a method verifying whether the current user has rights to a given resource. Then I have overriden GlobalMethodSecurityComfiguration.createExpressionHandler() and then…
Greg
  • 1,227
  • 5
  • 23
  • 52
2
votes
1 answer

Webflux - How to prevent an IllegalReferenceCountException when executing 2 WebClient request in parallel

I am using the spring WebClient to make two calls in parallel. One of the call results is passed back as a ResponseEntity, and the other result is inspected and then disregarded. Although the transactions are both successful, I see an…
MichaelM
  • 31
  • 2
2
votes
1 answer

Jaeger with webflux and webclient

Please take a look at https://github.com/winster/jaeger-trace-reactive/blob/master/src/main/java/com/example/demo/JaegerTraceReactiveApplication.java (readme might help to understand the problem better…
Winster
  • 943
  • 10
  • 28
2
votes
1 answer

How to print raw HTTP Request and HTTP Response with Spring 5 Webclient?

Spring MVC allows for logging of request and response body to allow for easier debugging and verification of message content. This is required for my project for auditing purposes, the log messages MUST contain the full request and response…
StevenPG
  • 311
  • 4
  • 16
2
votes
2 answers

Flux: How to prevent element processing when some element has concrete value?

The following test method: @Test void testMe() { Flux.just(1, 2, 3, 4, 5) .map(this::saveInDb) .toStream().count(); } int saveInDb(int element) { System.out.println(element + " successfully stored in DB."); …
user471011
  • 7,104
  • 17
  • 69
  • 97
2
votes
0 answers

Is there any way to use same epoll thread for spring webflux and lettuce

Spring webflux and lettuce both use netty. As a result, both create epoll thread. We know, to minimize thread context switch cost it's better to create the available number of processor's equivalent epoll thread. But when we are using those in the…
A M S Rejuan
  • 447
  • 6
  • 12