TakeUntil Operator

Rocket.take_untilFunction
take_until(notifier::S)

Creates a take operator, which returns an Observable that emits the values emitted by the source Observable until a notifier Observable emits a value or a completion event.

Arguments

  • notifier::S: The Observable whose first emitted value will cause the output Observable of take_until to stop emitting values from the source Observable.

Producing

Stream of type <: Subscribable{L} where L refers to type of source stream

Examples

using Rocket

source = interval(100) |> take_until(timer(1000))

subscribe!(source, logger())
;

# output

[LogActor] Data: 0
[LogActor] Data: 1
[LogActor] Data: 2
[LogActor] Data: 3
[LogActor] Data: 4
[LogActor] Data: 5
[LogActor] Data: 6
[LogActor] Data: 7
[LogActor] Data: 8
[LogActor] Completed
using Rocket 

source = interval(100)

subscribe!(source |> take_until(source |> filter(i -> i == 3)), logger())
;

# output 

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

See also: AbstractOperator, InferableOperator, ProxyObservable, logger

source

Description

take_until subscribes and begins mirroring the source Observable. It also monitors a second Observable, notifier that you provide. If the notifier emits a value, the output Observable stops mirroring the source Observable and completes. If the notifier doesn't emit any value and completes then take_until also completes.

See also

Operators