1
Given the code below:
fun method() {
return gateway1.getPerson(id)
.filter { isPersonValid(it) }
.flatMap { gateway2.isPersonHasAddress(id) } // Retorna Mono<Boolean>
.filter { it }
.switchIfEmpty { Mono.just(false) }
}
private fun isPersonValid(person: Person) {
// verifica se é valido
}
It is possible after each filter .. if it returns false, to call a method to log something ? Ai after that to switchIfEmpty ?! Remembering that the log that is the example action is different for both, so you wouldn’t necessarily put the call inside the switchIfEmpty