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

How can I switch to the default thread pool in Spring Webflux / Reactor?

Reactor provides possibility to shift execution context to a different Scheduler like following: Mono.just("test") .doOnNext(x -> System.out.println(currentThread().getName() + " " + x)) .publishOn(MY_SCHEDULER) .doOnNext(x…
fyrkov
  • 2,245
  • 16
  • 41
2
votes
1 answer

Spring WebFlux with ReactiveMongoRepository: not getting database updates through the stream

The issue I am facing: Whatever I try through various tutorials on using Spring Reactive (WebFlux) REST API's, I am unable to get it to work. When I initially call my endpoint, I am able to get the results from the MongoDB collection. However,…
vv01
  • 81
  • 10
2
votes
3 answers

how to use Spring Cloud Gateway without Reactive stuff?

I want to create a new project with Spring Cloud Gateway but I don't want all the reactive functionality. for me, it will be fine if the other microservice will be blocking I/O and not Reactive. how can I do that? let's say I'm implementing cloud…
Viz
  • 47
  • 1
  • 5
2
votes
1 answer

How we can compare two values of flux using springreactor

Currently I am new in reactive programming , I have added data in 2 documents, so currently what I am trying to do is to return only those data to client whose tokenIdentifier is same in both document. Please refer the code below: I have 2…
2
votes
0 answers

Reactor Retry: reactor.retry.Retry vs. reactor.util.retry.Retry

First time I use retry pattern in reactor. I have got totally confused with the management of retrying in reactor. The main source of confusion is the existing 2 Retry classes in the same package! I want to retry a Mono/Flux process when specific…
Sourcerer
  • 1,891
  • 1
  • 19
  • 32
2
votes
1 answer

How to trace incoming requests with AWS X-Ray on Spring Boot WebFlux?

I have multiple microservices running on AWS ECS and I want to try out AWS X-Ray. Following this developer guide I added a WebConfig.java file with a tracing filter. Added lines to build.gradle: implementation…
2
votes
1 answer

How to fetch the index number while doing a flatMap() on a Flux

I have a code block as below var x = Flux.just("A", "B", "C", "D"); x.flatMap(y -> { System.out.println(y); return Mono.just(y); }).subscribe(); This successfully prints: A B C D Is there a way I can print…
2
votes
1 answer

Do you have a test to show differences between the reactor map() and flatMap()?

I am still trying to understand the difference between the reactor map() and flatMap() method. First I took a look at the API, but it isn't really helpful, it confused me even more. Then I googled a lot, but it seems like nobody has an example to…
F4k3d
  • 653
  • 1
  • 10
  • 29
2
votes
0 answers

Spring boot reactive and GraalVM java.lang.NoClassDefFoundError: Could not initialize class reactor.netty.http.client.HttpClientSecure

When I'm creating a native image using Spring reactive and WebClient everything ends correctly but when I'm making a request using the WebClient, I get this error given below : 2021-01-10 04:10:22.904 ERROR 1 --- [ctor-http-nio-2]…
2
votes
1 answer

Deep "flatReduce" for WebFlux?

I have defined an operator flatReduce() which is to reduce() what flatMap() is to map(): public class FlatReduce { public static Mono flatReduce(Mono initial, Iterable items, BiFunction> accumulator) { for…
2
votes
2 answers

How to access to request body using WebFlux and Netty HttpClient

I need to calculate some kind of digest of the request body using the WebClient of Webflux and this digest must be set into a HTTP header. Using the good old Spring MVC ClientHttpRequestInterceptor is easy because the request body is provided as an…
Claudio Tasso
  • 417
  • 5
  • 13
2
votes
2 answers

How do you build a reactive in-memory repository with Spring WebFlux?

I'm trying to implement a reactive, in-memory repository. How should this be accomplished? This is a blocking version of what I'm trying to do @Repository @AllArgsConstructor public class InMemEventRepository implements EventRepository { …
user14900768
2
votes
2 answers

Disable Spring Boot Webclient logs

I want to build a simple Spring Web Client who send message from stdin but the WebClient show all debug informations on stdout. How to disable the logs generated by Webclient ? Code of the client WebClient webclient =…
Ryoh
  • 37
  • 1
  • 6
2
votes
2 answers

How can I wait until multiple WebClient Flux requests are finished?

I want to: subscribe to multiple endpoints returning Flux and output the messages I receive. wait until all messages have been output from all endpoints before continuing. avoid processing messages from multiple endpoints "together" (e.g. Flux.zip)…
Rupert Madden-Abbott
  • 12,899
  • 14
  • 59
  • 74
2
votes
1 answer

Spring WebFlux switchIfEmpty to return different type

public Mono getMessage(ServerRequest request) { //this call returns Mono return apiClient.hystrixWrappedGetMessages(request.headers().asHttpHeaders(), request.queryParams()) .switchIfEmpty(/*…