Reactor: how to get items from combineLatest on fluxes that a subset of can be empty

318 Views Asked by At

I am using Flux.combineLatest(combinator, stream1, stream2, ...) method to get latest items from each input stream. This will emit an item only once each input stream emits at least one value, in other words, no item will flow out if there's at least one empty flux, whereas I combine fluxes with two types of data:

  • one that is required to contain data before combineLatest emits
  • another that is optional - lack of items on it shouldn't block emissions from combineLatest

Once optional fluxes start to emit data, they should be treated just like the other fluxes with required data.

I went through reactor docs and couldn't find a suitable operator that would do the job.

The only workaround idea I have is to prepend (startWith) optional fluxes with some dummy data that I would then identify and exclude in a combinator function, but it's not very appealing to me.

0

There are 0 best solutions below