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

Can I have Flux as a field of ServerResponse body?

I'm new to Spring Reactive Web, and i met the following issue. I want to create a microservice A with an endpoint which accepts a number N, sends N requests to microservice B (which returns a string for each request), wraps the strings into objects,…
Gene Parmon
  • 95
  • 10
2
votes
1 answer

what is wrong with below webclient config?

I am facing connection error. Log entries are readAddress(..) failed: Connection reset by peer; nested exception is io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed: Connection reset by peer the connection observed an…
2
votes
2 answers

How to save the request body after reading it in the ServerAuthenticationConverter?

Guys! maybe someone faced the problem of getting the request body.. I am trying to friend Spring WebFlux + Security: I use SecurityConfig @EnableWebFluxSecurity @EnableReactiveMethodSecurity public class SecurityConfig { ... where I…
Julia
  • 81
  • 1
  • 6
2
votes
0 answers

SpringBoot RSockets Kotlin - Missing 'rsocketResponse'

I'm trying to make example chat application and I'm getting strange error when using fire-and-forget from my ReactJs rsocket-websocket-client. The only thing I found GitHub - Fix RSocket Fire and forget handling with Kotlin Could there be a problem…
Michal
  • 803
  • 2
  • 9
  • 26
2
votes
1 answer

How to do pagination in Reactor?

I make repeated paged WebClient requests to a third-party web service. The implementation I have now works but is blocking. My implementation so far: var elementsPerPage = 10; Flux .generate( () -> 0, (pageIndex, emitter) -> { …
2
votes
1 answer

How to test Spring Boot @WebFluxTest with Spring Security @Secured annotation

I'm having troubles testing a Spring WebFlux controller secured by Spring Security's @Secured annotation. Here is my controller code : @RestController @RequestMapping("/endpoint") public class MyController { @GetMapping() @Secured("ADMIN") …
2
votes
1 answer

Why WebFlux-WebClient Timeout not working?

I am using Spring boot Webflux 2.4.4 (latest) and trying to invoke a backend URL using WebClient. WebClient always responds above 20 secs. If I hit the URL directly it responds in milliseconds. Pom Looks below:
pri
  • 49
  • 2
  • 5
2
votes
1 answer

Spring Webflux HandlerMethodArgumentResolver not executing

I am working on a project using spring webflux. I have to add custom annotations on query params in controller and have some logic on them , came into HandlerMethodArgumentResolver. However i haven't been able to get it to work object…
matrixguy
  • 286
  • 1
  • 6
  • 30
2
votes
1 answer

Blocking calls in Reactive Stream

I wonder if normal java API calls (I mean methods without I/O) should be threaded as a "mini blocking calls"? Is it acceptable to implement Reactive Streams like this (invoking method before returning Publisher): public Mono
destro1
  • 99
  • 9
2
votes
0 answers

Content-Range header not set by webflux Webclient

Using the flux Webclient, I'm trying to stream a org.springframework.core.io.buffer.DataBuffer file I downloaded from another webclient to a new endpoint. This endpoint (which I do not control) requires 2 headers to be set on the upload:…
Philippe
  • 446
  • 2
  • 12
2
votes
1 answer

Webflux subscriber

I'm currently facing an issue about saving on redis inside a switchIfEmpty function. Probably is related to the fact I'm pretty new in Reactive Programming and unfortunately I struggling to find proper examples about it. However I've been able to…
Maxuel
  • 127
  • 10
2
votes
1 answer

In Reactor Flux an onCancel call is not returned to calling method

I have a set of methods that handle a Flux so @GetMapping(value = "/web/{s}") public Flux getWeb(@PathVariable String s) { return myService.getFlux(s); } In the service class: public Flux getFlux(String json) throws…
rupweb
  • 3,052
  • 1
  • 30
  • 57
2
votes
2 answers

How to continually consume from Kafka topic using spring webflux?

I have a spring-webflux handler named WordListenerHandler which I can request a HTTP GET from the browser. This request is a stream of Long using Flux: .body(Flux.interval(Duration.ofSeconds(1)).log(), Long.class) so it continually update the HTML…
Felipe
  • 7,013
  • 8
  • 44
  • 102
2
votes
1 answer

How to call switchIfEmpty when the flatMap returns an empty Mono?

My title sounds confusing so let me explain with some imperative pseudo code for what I'm trying to do Mono func() { Mono myThing = getMyThing(); if myThing is not empty: return doSomething(); else: return…
kane
  • 5,465
  • 6
  • 44
  • 72
2
votes
0 answers

Sleuth 3.0.1 + Spring Cloud Gateway = traceids do not correlate on request/response

Well I have a new setup with Sleuth 3.0.1 where by default spring.sleuth.reactor.instrumentation-type is set to manual Therefore I wrapped all my places where I need to trace with WebFluxSleuthOperators.withSpanInScope(tracer, currentTraceContext,…