Merged Observable

Rocket.mergedFunction
merged(sources::T) where { T <: Tuple }

Creation operator for the MergeObservable with a given sources collected in a tuple. merge subscribes to each given input Observable (as arguments), and simply forwards (without doing any transformation) all the values from all the input Observables to the output Observable. The output Observable only completes once all input Observables have completed. Any error delivered by an input Observable will be immediately emitted on the output Observable.

Examples

using Rocket

observable = merged((from(1:4), of(2.0), from("Hello")))

subscribe!(observable, logger())
;

# output
[LogActor] Data: 1
[LogActor] Data: 2
[LogActor] Data: 3
[LogActor] Data: 4
[LogActor] Data: 2.0
[LogActor] Data: H
[LogActor] Data: e
[LogActor] Data: l
[LogActor] Data: l
[LogActor] Data: o
[LogActor] Completed
using Rocket

subject = Subject(Int, scheduler = AsyncScheduler())

observable = merged((subject, of(2.0), from("Hello")))

actor = sync(logger())

subscribe!(observable, actor)

setTimeout(200) do
    next!(subject, 1)
    complete!(subject)
end

wait(actor)
;

# output
[LogActor] Data: 2.0
[LogActor] Data: H
[LogActor] Data: e
[LogActor] Data: l
[LogActor] Data: l
[LogActor] Data: o
[LogActor] Data: 1
[LogActor] Completed

See also: Subscribable

source