Race Observable
Rocket.race
— Functionrace(sources...)
race(sources::S) where { S <: Tuple }
Combines multiple Observables to create an Observable that mirrors the output of the first Observable to emit an item. Essentially it subscribes to the observable that was the first to start emitting.
Arguments
sources
: input sources
Examples
using Rocket
source1 = of(1)
source2 = of(2)
subscribe!(race(source1, source2), logger())
;
# output
[LogActor] Data: 1
[LogActor] Completed
using Rocket
source1 = of(1) |> async()
source2 = of(2)
subscribe!(race(source1, source2), logger())
;
# output
[LogActor] Data: 2
[LogActor] Completed
See also: Subscribable
, subscribe!