T - the type of items emitted by the ConnectableFlowablepublic abstract class ConnectableFlowable<T> extends Flowable<T>
ConnectableFlowable resembles an ordinary Flowable, except that it does not begin
emitting items when it is subscribed to, but only when its connect(io.reactivex.functions.Consumer<? super io.reactivex.disposables.Disposable>) method is called. In this way you
can wait for all intended Subscribers to Flowable.subscribe() to the Flowable
before the Flowable begins emitting items.

| Constructor and Description |
|---|
ConnectableFlowable() |
| Modifier and Type | Method and Description |
|---|---|
Flowable<T> |
autoConnect()
Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable
when the first Subscriber subscribes.
|
Flowable<T> |
autoConnect(int numberOfSubscribers)
Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable
when the specified number of Subscribers subscribe to it.
|
Flowable<T> |
autoConnect(int numberOfSubscribers,
Consumer<? super Disposable> connection)
Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable
when the specified number of Subscribers subscribe to it and calls the
specified callback with the Subscription associated with the established connection.
|
Disposable |
connect()
Instructs the
ConnectableFlowable to begin emitting the items from its underlying
Flowable to its Subscribers. |
abstract void |
connect(Consumer<? super Disposable> connection)
Instructs the
ConnectableFlowable to begin emitting the items from its underlying
Flowable to its Subscribers. |
Flowable<T> |
refCount()
Returns a
Flowable that stays connected to this ConnectableFlowable as long as there
is at least one subscription to this ConnectableFlowable. |
all, amb, ambArray, ambWith, any, as, blockingFirst, blockingFirst, blockingForEach, blockingIterable, blockingIterable, blockingLast, blockingLast, blockingLatest, blockingMostRecent, blockingNext, blockingSingle, blockingSingle, blockingSubscribe, blockingSubscribe, blockingSubscribe, blockingSubscribe, blockingSubscribe, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, bufferSize, cache, cacheWithInitialCapacity, cast, collect, collectInto, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatestDelayError, combineLatestDelayError, combineLatestDelayError, combineLatestDelayError, combineLatestDelayError, combineLatestDelayError, compose, concat, concat, concat, concat, concat, concat, concatArray, concatArrayDelayError, concatArrayEager, concatArrayEager, concatDelayError, concatDelayError, concatDelayError, concatEager, concatEager, concatEager, concatEager, concatMap, concatMap, concatMapCompletable, concatMapCompletable, concatMapCompletableDelayError, concatMapCompletableDelayError, concatMapCompletableDelayError, concatMapDelayError, concatMapDelayError, concatMapEager, concatMapEager, concatMapEagerDelayError, concatMapEagerDelayError, concatMapIterable, concatMapIterable, concatMapMaybe, concatMapMaybe, concatMapMaybeDelayError, concatMapMaybeDelayError, concatMapMaybeDelayError, concatMapSingle, concatMapSingle, concatMapSingleDelayError, concatMapSingleDelayError, concatMapSingleDelayError, concatWith, concatWith, concatWith, concatWith, contains, count, create, debounce, debounce, debounce, defaultIfEmpty, defer, delay, delay, delay, delay, delay, delay, delaySubscription, delaySubscription, delaySubscription, dematerialize, distinct, distinct, distinct, distinctUntilChanged, distinctUntilChanged, distinctUntilChanged, doAfterNext, doAfterTerminate, doFinally, doOnCancel, doOnComplete, doOnEach, doOnEach, doOnError, doOnLifecycle, doOnNext, doOnRequest, doOnSubscribe, doOnTerminate, elementAt, elementAt, elementAtOrError, empty, error, error, filter, first, firstElement, firstOrError, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMapCompletable, flatMapCompletable, flatMapIterable, flatMapIterable, flatMapIterable, flatMapIterable, flatMapMaybe, flatMapMaybe, flatMapSingle, flatMapSingle, forEach, forEachWhile, forEachWhile, forEachWhile, fromArray, fromCallable, fromFuture, fromFuture, fromFuture, fromFuture, fromIterable, fromPublisher, generate, generate, generate, generate, generate, groupBy, groupBy, groupBy, groupBy, groupBy, groupBy, groupJoin, hide, ignoreElements, interval, interval, interval, interval, intervalRange, intervalRange, isEmpty, join, just, just, just, just, just, just, just, just, just, just, last, lastElement, lastOrError, lift, limit, map, materialize, merge, merge, merge, merge, merge, merge, merge, merge, mergeArray, mergeArray, mergeArrayDelayError, mergeArrayDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeWith, mergeWith, mergeWith, mergeWith, never, observeOn, observeOn, observeOn, ofType, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureDrop, onBackpressureDrop, onBackpressureLatest, onErrorResumeNext, onErrorResumeNext, onErrorReturn, onErrorReturnItem, onExceptionResumeNext, onTerminateDetach, parallel, parallel, parallel, publish, publish, publish, publish, range, rangeLong, rebatchRequests, reduce, reduce, reduceWith, repeat, repeat, repeatUntil, repeatWhen, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, retry, retry, retry, retry, retry, retryUntil, retryWhen, safeSubscribe, sample, sample, sample, sample, sample, sample, scan, scan, scanWith, sequenceEqual, sequenceEqual, sequenceEqual, sequenceEqual, serialize, share, single, singleElement, singleOrError, skip, skip, skip, skipLast, skipLast, skipLast, skipLast, skipLast, skipLast, skipUntil, skipWhile, sorted, sorted, startWith, startWith, startWith, startWithArray, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeActual, subscribeOn, subscribeOn, subscribeWith, switchIfEmpty, switchMap, switchMap, switchMapCompletable, switchMapCompletableDelayError, switchMapDelayError, switchMapDelayError, switchMapMaybe, switchMapMaybeDelayError, switchMapSingle, switchMapSingleDelayError, switchOnNext, switchOnNext, switchOnNextDelayError, switchOnNextDelayError, take, take, take, takeLast, takeLast, takeLast, takeLast, takeLast, takeLast, takeLast, takeLast, takeLast, takeUntil, takeUntil, takeWhile, test, test, test, throttleFirst, throttleFirst, throttleLast, throttleLast, throttleWithTimeout, throttleWithTimeout, timeInterval, timeInterval, timeInterval, timeInterval, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timer, timer, timestamp, timestamp, timestamp, timestamp, to, toFuture, toList, toList, toList, toMap, toMap, toMap, toMultimap, toMultimap, toMultimap, toMultimap, toObservable, toSortedList, toSortedList, toSortedList, toSortedList, unsafeCreate, unsubscribeOn, using, using, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, withLatestFrom, withLatestFrom, withLatestFrom, withLatestFrom, withLatestFrom, withLatestFrom, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipArray, zipIterable, zipWith, zipWith, zipWith, zipWithpublic abstract void connect(@NonNull Consumer<? super Disposable> connection)
ConnectableFlowable to begin emitting the items from its underlying
Flowable to its Subscribers.connection - the action that receives the connection subscription before the subscription to source happens
allowing the caller to synchronously disconnect a synchronous sourcepublic final Disposable connect()
ConnectableFlowable to begin emitting the items from its underlying
Flowable to its Subscribers.
To disconnect from a synchronous source, use the connect(io.reactivex.functions.Consumer) method.
@NonNull public Flowable<T> refCount()
Flowable that stays connected to this ConnectableFlowable as long as there
is at least one subscription to this ConnectableFlowable.Flowable@NonNull public Flowable<T> autoConnect()
The connection happens after the first subscription and happens at most once
during the lifetime of the returned Flowable. If this ConnectableFlowable
terminates, the connection is never renewed, no matter how Subscribers come
and go. Use refCount() to renew a connection or dispose an active
connection when all Subscribers have cancelled their Subscriptions.
This overload does not allow disconnecting the connection established via
connect(Consumer). Use the autoConnect(int, Consumer) overload
to gain access to the Disposable representing the only connection.
refCount(),
autoConnect(int, Consumer)@NonNull public Flowable<T> autoConnect(int numberOfSubscribers)
The connection happens after the given number of subscriptions and happens at most once
during the lifetime of the returned Flowable. If this ConnectableFlowable
terminates, the connection is never renewed, no matter how Subscribers come
and go. Use refCount() to renew a connection or dispose an active
connection when all Subscribers have cancelled their Subscriptions.
This overload does not allow disconnecting the connection established via
connect(Consumer). Use the autoConnect(int, Consumer) overload
to gain access to the Disposable representing the only connection.
numberOfSubscribers - the number of subscribers to await before calling connect
on the ConnectableFlowable. A non-positive value indicates
an immediate connection.@NonNull public Flowable<T> autoConnect(int numberOfSubscribers, @NonNull Consumer<? super Disposable> connection)
The connection happens after the given number of subscriptions and happens at most once
during the lifetime of the returned Flowable. If this ConnectableFlowable
terminates, the connection is never renewed, no matter how Subscribers come
and go. Use refCount() to renew a connection or dispose an active
connection when all Subscribers have cancelled their Subscriptions.
numberOfSubscribers - the number of subscribers to await before calling connect
on the ConnectableFlowable. A non-positive value indicates
an immediate connection.connection - the callback Consumer that will receive the Subscription representing the
established connection