MergeMap Operator

merge_map(::Type{R}, mappingFn::F = identity; concurrent::Int = typemax(Int)) where { R, F <: Function }

Creates a merge_map operator, which returns an Observable that emits the result of applying the projection function mappingFn to each item emitted by the source Observable and merging the results of the Observables obtained from this transformation.


  • ::Type{R}: the type of data of output Observables after projection with mappingFn
  • mappingFn::F: projection function with (data) -> Observable{R} signature
  • concurrent::Int: optional, default is typemax(Int), maximum number of input Observables being subscribed to concurrently


Stream of type <: Subscribable{R}


using Rocket

source = from([ 0, 0 ]) |> merge_map(Int, d -> from([ 1, 2, 3 ], scheduler = AsyncScheduler(0)))
subscribe!(source, logger())

# output

[LogActor] Data: 1
[LogActor] Data: 1
[LogActor] Data: 2
[LogActor] Data: 2
[LogActor] Data: 3
[LogActor] Data: 3
[LogActor] Completed

See also: AbstractOperator, RightTypedOperator, ProxyObservable, logger


See also