I need to combine two observables which usually produce values one after the other. The first sequence (let's call it Seq A
) produces more values than the second (Seq B
), but usually a bunch of values from the first observable are follewed by one value on the second. So basically I need to produce a value from the latest value of Seq A
and the latest of Seq B
.
However, it can happen that the second sequence doesn't produce a value. In that case, the combined sequence should still produce a value; when after a value from SeqA
and some timeout Seq B
still didn't produce a value, I need to produce a value from just Seq A
.
The marble diagram should look like this:
<-> Timeout No timeout
Seq A | a1-----------a2a3---------------a4a5-a6---------
Seq B | --b1----------------------------------b3--------
Output | ---x1--------------x2------------------x3-------
^ - I need this ^ - And this
where Output
basically is some combination of the values.
PS: I have a hard time explaining the problem consisely, so please excuse the title.