T
- the value typepublic final class ReplayProcessor<T> extends FluxProcessor<T,T> implements Fuseable, MultiProducer, Receiver
Fuseable.ConditionalSubscriber<T>, Fuseable.QueueSubscription<T>, Fuseable.ScalarCallable<T>, Fuseable.SynchronousSubscription<T>
UNSPECIFIED
Constructor and Description |
---|
ReplayProcessor(int bufferSize,
boolean unbounded)
Constructs a ReplayProcessor with bounded or unbounded
buffering.
|
Modifier and Type | Method and Description |
---|---|
static <T> ReplayProcessor<T> |
cacheLast()
Create a
ReplayProcessor from hot-cold ReplayProcessor that will not
propagate
cancel upstream if Subscription has been set. |
static <T> ReplayProcessor<T> |
cacheLastOrDefault(T value)
Create a
ReplayProcessor from hot-cold ReplayProcessor that will not
propagate
cancel upstream if Subscription has been set. |
ReplayProcessor<T> |
connect()
Trigger onSubscribe with a stateless subscription to signal this subscriber it can start receiving
onNext, onComplete and onError calls.
|
static <E> ReplayProcessor<E> |
create()
Create a new
ReplayProcessor using QueueSupplier.SMALL_BUFFER_SIZE backlog size, blockingWait
Strategy and auto-cancel. |
static <E> ReplayProcessor<E> |
create(int historySize)
Create a new
ReplayProcessor using QueueSupplier.SMALL_BUFFER_SIZE backlog size, blockingWait
Strategy and auto-cancel. |
static <E> ReplayProcessor<E> |
create(int historySize,
boolean unbounded)
Create a new
ReplayProcessor using QueueSupplier.SMALL_BUFFER_SIZE backlog size, blockingWait
Strategy and auto-cancel. |
long |
downstreamCount()
the number of downstream receivers
|
java.util.Iterator<?> |
downstreams()
the connected data receivers
|
long |
getCapacity()
Return defined element capacity
|
long |
getPrefetch()
The prefetch configuration of the
Flux |
boolean |
isStarted()
Has this upstream started or "onSubscribed" ?
|
boolean |
isTerminated()
Has this upstream finished or "completed" / "failed" ?
|
void |
onComplete() |
void |
onError(java.lang.Throwable t) |
void |
onNext(T t) |
void |
onSubscribe(org.reactivestreams.Subscription s) |
static <T> FluxProcessor<T,T> |
serialize()
|
void |
subscribe(org.reactivestreams.Subscriber<? super T> s) |
java.lang.Object |
upstream()
Return the direct source of data, Supports reference.
|
connectSink, connectSink, switchOnNext, wrap
all, any, as, awaitOnSubscribe, blockFirst, blockFirst, blockFirstMillis, blockLast, blockLast, blockLastMillis, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, bufferMillis, bufferMillis, bufferMillis, bufferMillis, bufferMillis, bufferMillis, cache, cache, cast, collect, collect, collectList, collectMap, collectMap, collectMap, collectMultimap, collectMultimap, collectMultimap, collectSortedList, collectSortedList, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, compose, concat, concat, concat, concat, concatDelayError, concatDelayError, concatDelayError, concatDelayError, concatMap, concatMap, concatMapDelayError, concatMapDelayError, concatMapDelayError, concatMapIterable, concatMapIterable, concatWith, count, create, create, defaultIfEmpty, defer, delay, delayMillis, delayMillis, delaySubscription, delaySubscription, delaySubscriptionMillis, delaySubscriptionMillis, dematerialize, distinct, distinct, distinctUntilChanged, distinctUntilChanged, doAfterTerminate, doOnCancel, doOnComplete, doOnError, doOnError, doOnError, doOnNext, doOnRequest, doOnSubscribe, doOnTerminate, elapsed, elementAt, elementAtOrDefault, empty, error, error, every, everyFirst, filter, firstEmitting, firstEmitting, firstEmittingWith, flatMap, flatMap, flatMap, flatMap, flatMap, flatMapIterable, flatMapIterable, from, fromArray, fromIterable, fromStream, generate, generate, generate, groupBy, groupBy, groupJoin, handle, hasElement, hasElements, hide, ignoreElements, interval, interval, intervalMillis, intervalMillis, intervalMillis, intervalMillis, join, just, just, last, log, log, log, map, mapError, mapError, mapError, materialize, merge, merge, merge, merge, merge, merge, mergeWith, never, next, onAssembly, onAssembly, onBackpressureBuffer, onBackpressureDrop, onBackpressureDrop, onBackpressureError, onBackpressureLatest, onErrorResumeWith, onErrorResumeWith, onErrorResumeWith, onErrorReturn, onErrorReturn, onErrorReturn, onTerminateDetach, parallel, parallel, parallel, process, process, process, process, publish, publish, publish, publish, publishNext, publishOn, publishOn, range, reduce, reduce, reduceWith, repeat, repeat, repeat, repeat, repeatWhen, replay, replay, retry, retry, retry, retry, retryWhen, sample, sample, sampleFirst, sampleFirst, sampleFirstMillis, sampleMillis, sampleTimeout, sampleTimeout, scan, scan, scanWith, single, singleOrDefault, singleOrEmpty, skip, skip, skipLast, skipMillis, skipMillis, skipUntil, skipUntilOther, skipWhile, startWith, startWith, startWith, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, subscribeWith, switchIfEmpty, switchMap, switchMap, switchOnError, switchOnError, switchOnError, switchOnNext, switchOnNext, take, take, takeLast, takeMillis, takeMillis, takeUntil, takeUntilOther, takeWhile, then, then, then, thenMany, thenMany, timeout, timeout, timeout, timeout, timeout, timeoutMillis, timeoutMillis, timeoutMillis, timeoutMillis, timestamp, toIterable, toIterable, toIterable, toStream, toStream, toString, transform, using, using, window, window, window, window, window, window, window, window, windowMillis, windowMillis, windowMillis, windowMillis, windowMillis, windowMillis, withLatestFrom, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipWith, zipWith, zipWith, zipWith, zipWithIterable, zipWithIterable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
hasDownstreams
expectedFromUpstream, getError, getPending, isCancelled, limit, requestedFromDownstream
public ReplayProcessor(int bufferSize, boolean unbounded)
bufferSize
- if unbounded, this number represents the link size of the shared buffer,
if bounded, this is the maximum number of retained itemsunbounded
- should the replay buffer be unboundedpublic static <T> ReplayProcessor<T> cacheLast()
ReplayProcessor
from hot-cold ReplayProcessor
that will not
propagate
cancel upstream if Subscription
has been set. The last emitted item will be replayable to late Subscriber
(buffer and history size of 1).
T
- the relayed typeReplayProcessor
public static <T> ReplayProcessor<T> cacheLastOrDefault(T value)
ReplayProcessor
from hot-cold ReplayProcessor
that will not
propagate
cancel upstream if Subscription
has been set. The last emitted item will be replayable to late Subscriber
(buffer and history size of 1).
T
- the relayed typevalue
- a default value to start the sequence withReplayProcessor
public static <E> ReplayProcessor<E> create()
ReplayProcessor
using QueueSupplier.SMALL_BUFFER_SIZE
backlog size, blockingWait
Strategy and auto-cancel.E
- Type of processed signalspublic static <E> ReplayProcessor<E> create(int historySize)
ReplayProcessor
using QueueSupplier.SMALL_BUFFER_SIZE
backlog size, blockingWait
Strategy and auto-cancel.E
- Type of processed signalshistorySize
- public static <E> ReplayProcessor<E> create(int historySize, boolean unbounded)
ReplayProcessor
using QueueSupplier.SMALL_BUFFER_SIZE
backlog size, blockingWait
Strategy and auto-cancel.E
- Type of processed signalshistorySize
- maximum items retained if bounded, or link size if unboundedunbounded
- true if "unlimited" data store must be suppliedpublic static <T> FluxProcessor<T,T> serialize()
FluxProcessor
from hot
ReplayProcessor
safely gated by a serializing Subscriber
.
It will not propagate cancel upstream if Subscription
has been set. Serialization uses thread-stealing
and a potentially unbounded queue that might starve a calling thread if races are too important and
Subscriber
is slower.
T
- the relayed typeFluxProcessor
public void subscribe(org.reactivestreams.Subscriber<? super T> s)
subscribe
in interface org.reactivestreams.Publisher<T>
subscribe
in class FluxProcessor<T,T>
public java.util.Iterator<?> downstreams()
MultiProducer
downstreams
in interface MultiProducer
public long downstreamCount()
MultiProducer
downstreamCount
in interface MultiProducer
public long getCapacity()
Trackable
getCapacity
in interface Trackable
getCapacity
in class FluxProcessor<T,T>
public boolean isTerminated()
Trackable
isTerminated
in interface Trackable
public boolean isStarted()
Trackable
public java.lang.Object upstream()
Receiver
public void onSubscribe(org.reactivestreams.Subscription s)
onSubscribe
in interface org.reactivestreams.Subscriber<T>
public long getPrefetch()
Flux
Flux
getPrefetch
in class Flux<T>
Flux
, -1L if unspecifiedpublic void onError(java.lang.Throwable t)
onError
in interface org.reactivestreams.Subscriber<T>
public void onComplete()
onComplete
in interface org.reactivestreams.Subscriber<T>
public ReplayProcessor<T> connect()
FluxProcessor
Doing so MAY allow direct UNBOUNDED onXXX calls and MAY prevent Publisher
to subscribe this
subscriber.
Note that Processor
can extend this behavior to effectively start its subscribers.
connect
in class FluxProcessor<T,T>