T
- the input and output value typepublic abstract class ConnectableFlux<T> extends Flux<T>
Flux.publish()
,
Reactive-Streams-CommonsConstructor and Description |
---|
ConnectableFlux() |
Modifier and Type | Method and Description |
---|---|
Flux<T> |
autoConnect()
Connects this
ConnectableFlux to the upstream source when the first Subscriber
subscribes. |
Flux<T> |
autoConnect(int minSubscribers)
Connects this
ConnectableFlux to the upstream source when the specified amount of
Subscriber subscribes. |
Flux<T> |
autoConnect(int minSubscribers,
Consumer<? super Disposable> cancelSupport)
Connects this
ConnectableFlux to the upstream source when the specified amount of
Subscriber subscribes and calls the supplied consumer with a Disposable
that allows disconnecting. |
Disposable |
connect()
Connect this
ConnectableFlux to its source and return a Disposable that
can be used for disconnecting. |
abstract void |
connect(Consumer<? super Disposable> cancelSupport)
Connects this
ConnectableFlux to its source and sends a Disposable to a callback that
can be used for disconnecting. |
ConnectableFlux<T> |
hide()
Hides the identities of this
Flux instance. |
Flux<T> |
refCount()
Connects to the upstream source when the first
Subscriber subscribes and disconnects
when all Subscribers cancelled or the upstream source completed. |
Flux<T> |
refCount(int minSubscribers)
Connects to the upstream source when the given number of
Subscriber subscribes and disconnects
when all Subscribers cancelled or the upstream source completed. |
Flux<T> |
refCount(int minSubscribers,
Duration gracePeriod)
Connects to the upstream source when the given number of
Subscriber subscribes. |
Flux<T> |
refCount(int minSubscribers,
Duration gracePeriod,
Scheduler scheduler)
Connects to the upstream source when the given number of
Subscriber subscribes. |
all, any, as, blockFirst, blockFirst, blockLast, blockLast, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, bufferTimeout, bufferTimeout, bufferTimeout, bufferTimeout, bufferUntil, bufferUntil, bufferUntilChanged, bufferUntilChanged, bufferUntilChanged, bufferWhen, bufferWhen, bufferWhile, cache, cache, cache, cache, cache, cache, cancelOn, cast, checkpoint, checkpoint, checkpoint, collect, collect, collectList, collectMap, collectMap, collectMap, collectMultimap, collectMultimap, collectMultimap, collectSortedList, collectSortedList, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, concat, concat, concat, concat, concatDelayError, concatDelayError, concatDelayError, concatDelayError, concatMap, concatMap, concatMapDelayError, concatMapDelayError, concatMapDelayError, concatMapIterable, concatMapIterable, concatWith, concatWithValues, contextWrite, contextWrite, count, create, create, defaultIfEmpty, defer, deferContextual, deferWithContext, delayElements, delayElements, delaySequence, delaySequence, delaySubscription, delaySubscription, delaySubscription, delayUntil, dematerialize, distinct, distinct, distinct, distinct, distinctUntilChanged, distinctUntilChanged, distinctUntilChanged, doAfterTerminate, doFinally, doFirst, doOnCancel, doOnComplete, doOnDiscard, doOnEach, doOnError, doOnError, doOnError, doOnNext, doOnRequest, doOnSubscribe, doOnTerminate, elapsed, elapsed, elementAt, elementAt, empty, error, error, error, expand, expand, expandDeep, expandDeep, filter, filterWhen, filterWhen, first, first, firstWithSignal, firstWithSignal, firstWithValue, firstWithValue, flatMap, flatMap, flatMap, flatMap, flatMapDelayError, flatMapIterable, flatMapIterable, flatMapSequential, flatMapSequential, flatMapSequential, flatMapSequentialDelayError, from, fromArray, fromIterable, fromStream, fromStream, generate, generate, generate, getPrefetch, groupBy, groupBy, groupBy, groupBy, groupJoin, handle, hasElement, hasElements, ignoreElements, index, index, interval, interval, interval, interval, join, just, just, last, last, limitRate, limitRate, limitRequest, log, log, log, log, log, log, map, mapNotNull, materialize, merge, merge, merge, merge, merge, merge, mergeComparing, mergeComparing, mergeComparing, mergeComparingDelayError, mergeComparingWith, mergeDelayError, mergeOrdered, mergeOrdered, mergeOrdered, mergeOrderedWith, mergePriority, mergePriority, mergePriority, mergePriorityDelayError, mergeSequential, mergeSequential, mergeSequential, mergeSequential, mergeSequential, mergeSequential, mergeSequentialDelayError, mergeSequentialDelayError, mergeSequentialDelayError, mergeWith, metrics, name, never, next, ofType, onAssembly, onAssembly, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureDrop, onBackpressureDrop, onBackpressureError, onBackpressureLatest, onErrorComplete, onErrorComplete, onErrorComplete, onErrorContinue, onErrorContinue, onErrorContinue, onErrorMap, onErrorMap, onErrorMap, onErrorResume, onErrorResume, onErrorResume, onErrorReturn, onErrorReturn, onErrorReturn, onErrorStop, onTerminateDetach, or, parallel, parallel, parallel, publish, publish, publish, publish, publishNext, publishOn, publishOn, publishOn, push, push, range, reduce, reduce, reduceWith, repeat, repeat, repeat, repeat, repeatWhen, replay, replay, replay, replay, replay, replay, retry, retry, retryWhen, sample, sample, sampleFirst, sampleFirst, sampleTimeout, sampleTimeout, scan, scan, scanWith, share, shareNext, single, single, singleOrEmpty, skip, skip, skip, skipLast, skipUntil, skipUntilOther, skipWhile, sort, sort, startWith, startWith, startWith, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, subscribeOn, subscriberContext, subscriberContext, subscribeWith, switchIfEmpty, switchMap, switchMap, switchOnFirst, switchOnFirst, switchOnNext, switchOnNext, tag, take, take, take, take, takeLast, takeUntil, takeUntilOther, takeWhile, then, then, thenEmpty, thenMany, timed, timed, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timestamp, timestamp, toIterable, toIterable, toIterable, toStream, toStream, toString, transform, transformDeferred, transformDeferredContextual, using, using, usingWhen, usingWhen, window, window, window, window, window, window, window, windowTimeout, windowTimeout, windowTimeout, windowTimeout, windowUntil, windowUntil, windowUntil, windowUntilChanged, windowUntilChanged, windowUntilChanged, windowWhen, windowWhile, windowWhile, withLatestFrom, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipWith, zipWith, zipWith, zipWith, zipWithIterable, zipWithIterable
public final Flux<T> autoConnect()
Flux
that connects to the upstream source when the first Subscriber
subscribespublic final Flux<T> autoConnect(int minSubscribers)
ConnectableFlux
to the upstream source when the specified amount of
Subscriber
subscribes.
Subscribing and immediately unsubscribing still contributes to the counter that triggers the connection.
minSubscribers
- the minimum number of subscribersFlux
that connects to the upstream source when the given amount of Subscribers subscribedpublic final Flux<T> autoConnect(int minSubscribers, Consumer<? super Disposable> cancelSupport)
ConnectableFlux
to the upstream source when the specified amount of
Subscriber
subscribes and calls the supplied consumer with a Disposable
that allows disconnecting.
minSubscribers
- the minimum number of subscriberscancelSupport
- the consumer that will receive the Disposable
that allows disconnectingFlux
that connects to the upstream source when the given amount of subscribers subscribedpublic final Disposable connect()
ConnectableFlux
to its source and return a Disposable
that
can be used for disconnecting.Disposable
that allows disconnecting the connection after.public abstract void connect(Consumer<? super Disposable> cancelSupport)
ConnectableFlux
to its source and sends a Disposable
to a callback that
can be used for disconnecting.
The call should be idempotent in respect of connecting the first and subsequent times. In addition, the disconnection should be tied to a particular connection (so two different connections can't disconnect the other).
cancelSupport
- the callback is called with a Disposable instance that can
be called to disconnect the source, even synchronously.public final ConnectableFlux<T> hide()
Flux
Flux
instance.
The main purpose of this operator is to prevent certain identity-based optimizations from happening, mostly for diagnostic purposes.
public final Flux<T> refCount()
Subscriber
subscribes and disconnects
when all Subscribers cancelled or the upstream source completed.
Flux
public final Flux<T> refCount(int minSubscribers)
Subscriber
subscribes and disconnects
when all Subscribers cancelled or the upstream source completed.
minSubscribers
- the number of subscribers expected to subscribe before connectionFlux
public final Flux<T> refCount(int minSubscribers, Duration gracePeriod)
Subscriber
subscribes.
Disconnection can happen in two scenarios: when the upstream source completes (or errors) then
there is an immediate disconnection. However, when all subscribers have cancelled,
a deferred disconnection is scheduled. If any new subscriber comes
in during the gracePeriod
that follows, the disconnection is cancelled.
public final Flux<T> refCount(int minSubscribers, Duration gracePeriod, Scheduler scheduler)
Subscriber
subscribes.
Disconnection can happen in two scenarios: when the upstream source completes (or errors) then
there is an immediate disconnection. However, when all subscribers have cancelled,
a deferred disconnection is scheduled. If any new subscriber comes
in during the gracePeriod
that follows, the disconnection is cancelled.
minSubscribers
- the number of subscribers expected to subscribe before connectiongracePeriod
- the Duration
for which to wait for new subscribers before actually
disconnecting when all subscribers have cancelled.scheduler
- the Scheduler
on which to run timeoutsFlux
with a grace period for disconnection