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