I'd like to return a value (or publisher) after a Flux
is completed. Here's an example with (pseudo) code that resembles what I'm after:
val myId : Mono<String> = fetchMyId()
myId.flatMap { id ->
someFlux.map { .. }.doOnNext { ... }.returnOnComplete(Mono.just(id))
}
I.e. I want to return id
after someFlux
has completed. The returnOnComplete
function is made-up and doesn't exists (there's a doOnComplete
function but it's for side-effects) which is why I'm asking this question. How can I do this?
thenReturn
is only onMono
, notFlux
– Lemkul