I am new to reactive (reactor.core) , I am trying to convert these 3 steps into reactive . 1)Filter List 2) Build request from output of Step-1 3)Call service from output of Step 2but I am getting an error while trying to use map on output of filter, Cannot infer type argument(s) for map(Function<? super T,? extends V>) . I am not sure how to fix this.
Flux.fromIterable(listForOrder)
.filter(ct -> !PaymentTypes.CASH.name().equalsIgnoreCase(ct.getPaymentType()))
.map( list-> this.buildRequest(returnCT, payment, list)) //use output of filter
.doOnSuccess(proxyRequest ->invokeProxy(payment, returnCT, nonCashCT, proxyRequest, loggerKey))
;
Original Code
// filter Non-CASH CT and call Proxy for them
List<ChargeTransaction> nonCashCT = Flux.fromIterable(listForOrder)
.filter(ct -> !PaymentTypes.CASH.name().equalsIgnoreCase(ct.getPaymentType()))
.collect(Collectors.toList()).block();
// Build request call PG for NON-CASH CT
PaymentProxyRequest proxyRequest = buildRequest(returnCT, payment, nonCashCT);
log.info("{} JSON Proxy Request for chargeTransactionId={} is={} ", loggerKey, returnCT.getId(),
JsonMapper.toJson(proxyRequest));
invokeProxy(payment, returnCT, nonCashCT, proxyRequest, loggerKey);