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

Spring Webflux: Do I need to catch(Throwable) for triggering Mono.doOnError?

I have the following Code that creates a product and then logs the creation-success in some kind of history service (the journalClient). If there is an error in the journal client I want to rollback the product creation. @Service public class…
MarkusJackson
  • 225
  • 2
  • 12
2
votes
1 answer

Example of error handling calling Restful services with WebFlux

I'm looking for a simple example of error handling with WebFlux. I've read lots of stuff online, but can't find something that fits what I want. I'm running with Spring Boot 2.45 I am calling services like this: Mono mono =…
2
votes
1 answer

Spring Webclient sometime doesn't read 204 response

I am using Spring WebClient to call an internal API but sometime my webClient doesn't analyse the response code and stay block on "exchangeToMono" method and waiting . I use : spring-boot-starter-parent 2.5.2 spring webclient 5.3.8 I migrate to…
2
votes
0 answers

spring webflux with keycloak authentication over netty server

i want to run webflux based web app using non blocking netty server and authentication using keycloak. seems like keycloak does not support netty server. is there a way to override default behavior of keycloak and use netty instead of tomcat? this…
2
votes
1 answer

Grafana dashboard separating "boundedElastic" vs "parallel" for executor pool

Small question regarding how to build Grafana dashboards which separates "boundedElastic" vs "parallel" please. Currently with a Spring Webflux app, I get out of the box very useful metrics for Reactor…
PatPanda
  • 3,644
  • 9
  • 58
  • 154
2
votes
1 answer

Thread safety for method that returns Mono based on mutable attribute in Java

In my Spring Boot application I have a component that is supposed to monitor the health status of another, external system. This component also offers a public method that reactive chains can subscribe to in order to wait for the external system to…
Mercious
  • 378
  • 3
  • 25
2
votes
0 answers

Spring Boot: Why is ServerWebExchange getRequest().getMethod() sometimes null?

I am using a custom WebFilter in Spring Boot to gather diagnostic information about reactive HTTP requests, in the filter(ServerWebExchange exchange, WebFilterChain chain) method. At the start of filter(), I can successfully get the method value…
2
votes
1 answer

How to use Resilience4j Circuit Breaker with WebFlux in Spring Boot

I have service A that calls downstream service B. Service A code @RestController @RequestMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE) public class GreetingController { private final GreetingService greetingService; …
2
votes
1 answer

CPU metrics in Grafana for Spring Webflux app with Actuator Micrometer and Prometheus

Small question on how to build visual and insight on CPU metrics please. I have a Spring Boot Webflux app, nothing extraordinary. I bring in the Actuator, Micrometer and Prometheus dependencies. The app have out of the box metrics for CPU, which I…
2
votes
4 answers

How to add a query parameter for all requests in Spring Webflux

How can I put query params into all requests in spring webflux avoiding code duplication in all places where I open http connection? I try to make a configuration for a WebClient bean with a filter that should put a query param in URL every time…
Aleksei
  • 97
  • 1
  • 2
  • 9
2
votes
3 answers

Java Convert FilePart to byte[] in Springboot using Webflux

I want to get the byte content of the File. Here is my controller: @PostMapping("/files") @ResponseStatus(HttpStatus.OK) public List uploadFile(@RequestPart("file") FilePart file) { // I want to get the bytes[] content of my…
user3648235
  • 169
  • 4
  • 13
2
votes
2 answers

How to repeat Mono while not empty

I have a method which returns like this! Mono getNumberFromSomewhere(); I need to keep calling this until it has no more items to emit. That is I need to make this as Flux. One option is to add repeat. the point is - I want to…
RamPrakash
  • 2,218
  • 3
  • 25
  • 54
2
votes
1 answer

Is there any function in reactor.util.retry.Retry that i can use when retry is successful

I need to perform some action immediately after Retry is successful for server-sent event implementation, I was unable to find any method in reactor.util.retry.Retry. Is there any other alternate to do doOnRetrySuccess(func)
2
votes
1 answer

Disable specific ServletContextListener to prevent startup on tomcat

My project is using spring boot with webflux, tomcat. I have a internal library class that is a ServletContextListener @WebListener public class DevIoServletContextListener implements ServletContextListener { @Inject private DevIoInjector…
chewie
  • 333
  • 2
  • 3
  • 19
2
votes
1 answer

How to throw another exception in Mono?

I try to wrap exception that thrown in Mono into another exception. I try to use onErrorResume() and doOnError() methods, but it does not help. How can I do it? return response .handle((responseData, sink) -> handleStatus(data,…
petrov.aleksandr
  • 622
  • 1
  • 5
  • 24