These are chat archives for ReactiveX/RxJava

6th
Nov 2018
marc
@marcules
Nov 06 2018 08:57

Hi, I'm trying to figure out if my usage of RxJava (with Spring) is a) actually an use-case for reactive and b) if I'm doing it right, because I have to jump through some (perceived?) hoops to get to the result I want, so I'm doubting that I'm doing it right.

I have a request R, that is passed through some "fixers" F(R) that require a Single/Mono and return a Single/Mono of the same type, then this Mono/Single F(R) is passed into "validators" V(F(R)) that require a Single/Mono of type R and return a Single/Mono of type bool; when all V(F(R)) are returned and true I want to send them to some "performers" P(F(R)) that require the Single/Mono of type R and return a result and take the first of the results.

I have a problem with that setup, because I have to "reuse" F(R) for both the validators and the performers, so I would either have to wait after all validators are done and then pass the original F(R) value to P(F(R)) or have to zip the validation result with F(R) and pass that into P(F(R)) < is the second approach idiomatic?

Also I have to "wait" for all F(R) to finish before passing them to the validators, unless I want to call the methods behind F(R) multiple times for each V(F(R)) - I'm missing a "andThen" method or something? Which passes the value from the Mono to the next Mono? (Is there such a concept and I've missed it? Because mono.then(otherMono) has no connection between the values)

Helder Sousa
@htmsousa
Nov 06 2018 11:00
I think you want to use something like a
selmangurgen
@selmangurgen
Nov 06 2018 18:52
Hi guys, i have a question, i have nested io-read operations in my reactive app using webflux stack. i want to get best performance with thread management.
i tried single(), elastic(),parallel() and other commands. but i didnt see any difference with respect of their speeds
i get data hierarctically, thatswhy i have nested flatmaps . what do you suggest about such io operation with Scheduler methods or any other way to get better performance
selmangurgen
@selmangurgen
Nov 06 2018 19:02
}).log().subscribeOn(Schedulers.elastic());
return stageMap.then(Mono.just(seasonDto));
}).log().subscribeOn(Schedulers.elastic());
return seasonMap.then(Mono.just(tournamentDto));
}).log().subscribeOn(Schedulers.elastic());
return tournamentDtoFlux.subscribeOn(Schedulers.single());
such nested read by filling parent object's fields