rx java2 - Reactive programming that calls onComplete based on a set and then repeats -




in reactivex, have series of events need group events sets based on event type , unique id.

so series looks this:

a1 a2 b1 c1 b2 c2 ...  

and oncompleted called based on following sets

[a1, b1, c1]  [a2, b2, c2] 

and repeat indefinitely 3, 4, 5 ...

if set takes long receive events, onerror should called.

with groupby possible group events id, , use and when 3 events isn't clear documentation how use along timeout.

you can use groupby, flatmap , takeuntil inside of flatmap have groups complete when terminal value discovered:

observable.fromarray("a1 a2 b1 c1 b2 c2".split("\\s")) .groupby(v -> v.charat(1))                            // <------------------ .flatmap(g -> g                .takeuntil(v -> v.charat(0) == 'c')    // <------------------                .tolist()) .subscribe(...) 

replace functions pointed @ grouping , end-detection function of datatype.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -