I have a requirement to get results from database and process the two records.
Flux<CurrencyRate> currenciesFlux = currencyRepository.findByCurrencyNameIn(List.of(from,to))
.map(CurrencyService::fromModel);
I get 2 records (Flux), and My next step is to divide one by the other.
If I use .collectList().block() to get List , I get exception as expected
java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-2
How to process data and return Mono < BigDecimal > ?
Example : ( not exactly like the below , but on similar lines)
convertedRate =
firstElement.getRate().divide(secondElement.getRate(), 3,
RoundingMode.HALF_EVEN);