Questions tagged [spring-reactor]
56 questions
8
votes
2 answers
How to Count Items in a Flux, return error if count is greater than X, else continue with Pipeline
I'm new to Project Reactor in Spring, and I'm not fully sure how to perform something:
I have my pipeline the pipeline returns records. All good.
But I would like to count those records and then do something (like if else), where if records returned…

Columb1a
- 463
- 2
- 11
- 25
7
votes
2 answers
How to bridge between a non-reactive Spring EventListener and a reactive Flux
What's the difference between creating a Flux directly by calling Flux.push and use the sink within push's lambada expression vs. using a sink provided by a DirectProcessor?
In a minimal example where a Flux just emits a couple of events, I could…

Stefan Haberl
- 9,812
- 7
- 72
- 81
6
votes
1 answer
transform vs transformDeferred
What is the difference between transform & transformDeferred in project reactor flux.
Good example will be helpful.
https://projectreactor.io/docs/core/release/reference/index.html#advanced-mutualizing-operator-usage

Andrew Sasha
- 1,254
- 1
- 11
- 21
5
votes
2 answers
Spring Reactor Webflux Scheduler Parallelism
For a fully non-blocking end to end reactive calls, is it recommended to explicitly call publishOn or subscribeOn to switch schedulers? For either cpu consuming or non consuming tasks, is it favorable to always use parallel flux to optimize…

user1955934
- 3,185
- 5
- 42
- 68
4
votes
1 answer
WebFlux - Reactor Http Epoll threads
I am using Spring webflux. I send hundreds of concurrent requests to the rest end point. When I checked, only 4 threads are being shared to handle all the loads.
Is this normal? Is there any spring property to increase this…

RamPrakash
- 2,218
- 3
- 25
- 54
4
votes
2 answers
File handing in WebFlux (Reactor)
I'm working on a greenfield reactive project where a lot of file handling IO is going on. Is it sufficient if I write the IO code in an imperative blocking manner and then wrap them in a Mono, publish them on boundedElastic scheduler? Will the…

Peter
- 323
- 1
- 16
- 46
4
votes
1 answer
How to read file lines while they appear and represent them as Flux?
Assume we depend on Reactor 3 (i.e in a Spring 5 application) and a text file my/file.txt.
I need to subscribe to the text file lines (both existing ones and those that will appear in the future) and create a Flux. If you wish, neglect…

diziaq
- 6,881
- 16
- 54
- 96
4
votes
1 answer
Why does ConnectableFlux.connect() block?
I'm new to Spring Reactor. I've been trying to understand how the ConnectableFlux class works. I've read the docs and seen examples posted online but am stuck on an issue.
Can someone tell me why the connect() method is blocking? I don't see…

Tim
- 109
- 8
3
votes
1 answer
Spring Gateway AsyncPredicate not working with reactor and flux
We have written a custom Predicate factory for the Spring-Gateway to route the requests. We are parsing the body of an XML request and then the route is being derived, based on particular Method existing in the Body. While doing this we have written…

Procrastinator
- 2,526
- 30
- 27
- 36
3
votes
1 answer
Cacheing in Spring webflux
Suprised it was so hard to find concrete info about this online.
Is it possible to cache results in spring webflux?
For eg: Could I have my rest service, and then use mongodb as the primary database, and redis as the cache. So when request comes…

user3038404
- 331
- 5
- 14
2
votes
2 answers
Why am I getting onComplete signal when an exception is encountered in Spring Cloud Stream reactive consumer?
I'm using Spring Reactor with Spring Cloud Stream (GCP Pub/Sub Binder) and running into error handling issues. I'm able to reproduce the issue with a very simple example:
@Bean
public Function, Mono> consumer() {
return flux…

Jon Catanio
- 283
- 1
- 3
- 11
2
votes
0 answers
Error with multiple, ordered annotations in Spring AOP and Reactor
I have these two annotation with their respective aspects:
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation class BackupCache
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation…

gotch4
- 13,093
- 29
- 107
- 170
2
votes
0 answers
Is there an easy way to get the elements intersection between a couple of Flux objects using Project Reactor (Java/Spring)?
I'm using Project Reactor with Spring boot in Java. I would like to know if there is an easy way to get the elements intersection between a couple of Flux objects using Project Reactor without blocking.
Thank you!

august0490
- 777
- 1
- 9
- 15
2
votes
0 answers
Aws Kinesis consume message reactive
I am trying to implement a kinesis consumer reactive. My current understanding is that a kinesis shard is always consumed by a thread so the thread consuming it will subscribe.
Here is my code:
private static CompletableFuture…

user1995187
- 393
- 5
- 18
2
votes
0 answers
retryWhen used with flatMap throws exception
I wanted to retry in case of any exception from the service. But when using retryWhen am getting exception java.lang.IllegalStateException: UnicastProcessor allows only a single Subscriber.
Without retry, its working fine
Flux.window(10)
…

Revathy Satheesh
- 21
- 1