combine multiple Observables into one by merging their emissions
interleave interleave* merge merge* merge-delay-error merge-delay-error*
In RxClojure there are six operators of concern here:
merge
RxCpp implements this operator as merge
.
merge mergeDelayError mergeWith
RxGroovy implements this operator as merge
, mergeWith
, and mergeDelayError
.
The instance version of merge
is mergeWith
, so, for example, in the code sample above, instead of writing Observable.merge(odds,evens)
you could also write odds.mergeWith(evens)
.
mergeWith(Observable)
If any of the individual Observables passed into merge
terminates with an onError
notification, the Observable produced by merge
itself will immediately terminate with an onError
notification. If you would prefer a merge that continues emitting the results of the remaining, error-free Observables before reporting the error, use mergeDelayError
instead.
merge mergeDelayError mergeWith
RxJava implements this operator as merge
, mergeWith
, and mergeDelayError
.
Instead of passing multiple Observables (up to nine) into merge
, you could also pass in a List<>
(or other Iterable) of Observables, an Array of Observables, or even an Observable that emits Observables, and merge
will merge their output into the output of a single Observable:
The instance version of merge
is mergeWith
, so, for example, instead of writing Observable.merge(odds,evens)
you could also write odds.mergeWith(evens)
.
If any of the individual Observables passed into merge
terminates with an onError
notification, the Observable produced by merge
itself will immediately terminate with an onError
notification. If you would prefer a merge that continues emitting the results of the remaining, error-free Observables before reporting the error, use mergeDelayError
instead.
merge mergeAll mergeDelayError
merge mergeDelayError mergeWith
RxKotlin implements this operator as merge
, mergeWith
, and mergeDelayError
.
Instead of passing multiple Observables (up to nine) into merge
, you could also pass in a List<>
(or other Iterable) of Observables, an Array of Observables, or even an Observable that emits Observables, and merge
will merge their output into the output of a single Observable:
The instance version of merge
is mergeWith
, so, for example, instead of writing Observable.merge(odds,evens)
you could also write odds.mergeWith(evens)
.
If any of the individual Observables passed into merge
terminates with an onError
notification, the Observable produced by merge
itself will immediately terminate with an onError
notification. If you would prefer a merge that continues emitting the results of the remaining, error-free Observables before reporting the error, use mergeDelayError
instead.
Merge
Rx.NET implements this operator as Merge
.
merge mergeAll
merge merge_all merge_observable
RxPY implements this operator as merge
and merge_all
/merge_observable
.
merge merge_all merge_concurrent
Rx.rb implements this operator as merge
, merge_concurrent
, and merge_all
.
merge_concurrent
operates on an Observable that emits Observables, merging the emissions from each of these Observables into its own emissions. You can optionally pass it an integer parameter indicating how many of these emitted Observables merge_concurrent
should try to subscribe to concurrently. Once it reaches this maximum subscription count, it will refrain from subscribing to any other Observables emitted by the source Observable until such time as one of the already-subscribed-to Observables issues an onCompleted
notification. The default is 1, which makes it equivalent to merge_all
.
flatten flattenDelayError merge mergeDelayError
RxScala implements this operator as flatten
, flattenDelayError
, merge
, and mergeDelayError
.
merge
RxSwift implements this operator as merge
.
© ReactiveX contributors
Licensed under the Apache License 2.0.
http://reactivex.io/documentation/operators/merge.html