LimitSubscribers Operator
Rocket.LimitSubscribersGuard — TypeLimitSubscribersGuard(limit::Int = 1, exclusive = true)Guard structure used in limit_subscribers operator.
Arguments
limit: number of concurrent subscribersexclusive: boolean flag, which indicates whenever this guard can be shared with other observables in otherlimit_subscribersoperator. If set totrue, reusing this guard in a differentlimit_subscribersoperator for other observable will result in automatic unsubscription of all present actors.
Note
This structure is useful in Pluto.jl notebooks in particular, allowing for automatic subscription/unsubscription of observables.
Example
# Cell 1
guard = LimitSubscribersGuard()
# Cell 2
subscription = subscribe!(some_stream |> limit_subscribers(guard), logger())See also: limit_subscribers, subscribe!
Rocket.limit_subscribers — Functionlimit_subscribers(limit::Int = 1, exclusive::Bool = true)
limit_subscribers(guard::LimitSubscribersGuard)Creates an operator that limits number of concurrent actors to the given observable. On new subscription, if limit is exceeded, oldest actor is automatically unsubscribed and receives a completion event.
Arguments
limit: number of concurrent subscribersexclusive: boolean flag, which indicates whenever this guard can be shared with other observables in otherlimit_subscribersoperator. If set totrue, reusing this guard in a differentlimit_subscribersoperator for other observable will result in automatic unsubscription of all present actors.
Note
This structure is useful in Pluto.jl notebooks in particular, allowing for automatic subscription/unsubscription of observables.
Example
# Cell 1
guard = LimitSubscribersGuard()
# Cell 2
subscription = subscribe!(some_stream |> limit_subscribers(guard), logger())See also: LimitSubscribersGuard