'how does flatMapDelayError flow working in flux to make parallel call
I want to call two differnt down stream service and have zip the results. I have tired the below, want to confirm is there is any other best approach that we have or how does flatMapDelayError functioning? i am not blocking the call anywhere. does this two calls will happen parallelly or the second call will wait for the first one? i want both the call should happen parallelly
Flux<EmpAddressDetail> empAddDetail = getTimeoutDuration()
.flatMapDelayError(duration -> timeoutWrappedEmpDetailFlux(Service.getemeEmpAddress(empno),
duration, Exception.ErrorCode.TIMED_OUT), CONCURRENCY, PREFETCH);
Flux<Employee> empInfo= getTimeoutDuration()
.flatMap(duration -> mapEmpTypes(empTypes)
.map(empTypedata -> Tuples.of(duration, empTypedata)))
.flatMapDelayError(durationEmpTuple -> getEmpdetails(empno, durationBusinessTuple.getT1(), durationEmpTuple.getT2())
.filter(empdetails -> requestTypes.contains(empdetails.getType()))
.doOnNext(empdetails -> empdetails.setEmpId(empno)), CONCURRENCY, PREFETCH);
return Flux.zip( empInfo, empAddDetail ).map(tuple -> {
Employee emp = tuple.getT1();
emp.setAddressDetail(tuple.getT2());
return emp;
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
