T - the type of itempublic abstract class ConnectableMulti<T> extends AbstractMulti<T>
ConnectableMulti is similar to a regular Multi, except that it does not begin
emitting items (from upstream to downstream) when it is subscribed to, but only when its connect(io.smallrye.mutiny.operators.multi.multicast.ConnectableMultiConnection) method is
called. This allows deferring the dispatching of events. For example, it can wait until a set number of subscribers
have subscribed.| Modifier | Constructor and Description |
|---|---|
protected |
ConnectableMulti(Multi<T> upstream) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
connect(ConnectableMultiConnection connection)
Allows this
ConnectableMulti to start emitting the items from its upstream Multi to
its Subscribers. |
Multi<T> |
connectAfter(int numberOfSubscribers)
Returns a
Multi that connect to the upstream as soon as the numberOfSubscribers subscribers
subscribe. |
Multi<T> |
referenceCount()
Returns a
Multi that stays connected to this ConnectableMulti as long as there
is at least one active subscription. |
Multi<T> |
referenceCount(int count,
Duration duration)
Connects to the upstream
ConnectableMulti if the number of subscribers reaches the specified amount and
disconnect after the specified duration after all subscribers have unsubscribed (cancelled their subscriptions). |
broadcast, cache, collectItems, convert, emitOn, groupItems, on, onCompletion, onFailure, onFailure, onFailure, onItem, onOverflow, onSubscribe, onTermination, runSubscriptionOn, subscribe, subscribe, subscribe, toUni, transformprotected abstract void connect(ConnectableMultiConnection connection)
ConnectableMulti to start emitting the items from its upstream Multi to
its Subscribers.connection - the connection.public Multi<T> referenceCount()
Multi that stays connected to this ConnectableMulti as long as there
is at least one active subscription.Multipublic Multi<T> referenceCount(int count, Duration duration)
ConnectableMulti if the number of subscribers reaches the specified amount and
disconnect after the specified duration after all subscribers have unsubscribed (cancelled their subscriptions).count - the number of subscribers that trigger the emissionsduration - the duration, can be null, if set must be positivepublic Multi<T> connectAfter(int numberOfSubscribers)
Multi that connect to the upstream as soon as the numberOfSubscribers subscribers
subscribe.
The connection stays opens even if the subscribers cancelled the subscription.
Other subscribers can subscribe, it would not re-subscribe to the upstream.numberOfSubscribers - the number of subscribe to reach before subscribing to upstream.Copyright © 2019–2020 SmallRye. All rights reserved.