Is there a way in Reactor to ignore error signals?
since you are already processing urls in a flatmap, use onErrorResume(e -> Mono.empty())
. this will let flatmap ignore the error.
edit: within the flatmap, on the right hand side of the lambda
Now we have reactor.core.publisher.onErrorContinue()
in version 3.3.2
, which allows you to send onNext()
signal when some elements is onError()
. Use log()
you will see better.
The signature is (throwable, instance)
so if you want to log the errored out one, is useful.
Flux.fromIterable(aList)
.flatMap(this::xxxx)
.onErrorContinue((throwable, o) -> {
log.error("Error while processing {}. Cause: {}", o, throwable.getMessage());
})
....
Flux.fromArray(trackersArray)
.flatMap(tracker ->
ConnectToTracker.connect(tracker.getTracker(), tracker.getPort())
.onErrorResume(SocketTimeoutException.class, __ -> Mono.empty()))
Maybe this is better of doing the same it will on recover from SocketTimeOut and if the exception is other i will go for the onError