concatMap()
Just as there is flatMap(), which dynamically merges observables, there is a concatenation counterpart called concatMap(). Use this operator if you care about ordering and want each Observable being mapped from each emission before starting the next one.
More specifically, concatMap() merges each mapped Observable sequentially and fires them one at a time. It moves to the next Observable when the current one calls onComplete(). If source emissions produce observables faster than concatMap() can emit from them, those observables are queued.
Our earlier flatMap() examples would be better suited for concatMap() if we explicitly cared about emission order. Although our example here has the same output as the flatMap() example, we ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access