IN - the input value typeOUT - the output value typepublic abstract class FluxProcessor<IN,OUT> extends Flux<OUT> implements Processor<IN,OUT>, CoreSubscriber<IN>, Scannable, Disposable
Flux API for Processor.
Implementors include UnicastProcessor, EmitterProcessor, ReplayProcessor.Scannable.Attr<T>Disposable.Composite, Disposable.SwapOPERATOR_NAME_UNRELATED_WORDS_PATTERN| Constructor and Description |
|---|
FluxProcessor() |
| Modifier and Type | Method and Description |
|---|---|
Context |
currentContext()
Request a
Context from dependent components which can include downstream
operators during subscribing or a terminal Subscriber. |
void |
dispose()
Cancel or dispose the underlying task or resource.
|
long |
downstreamCount()
Return the number of active
Subscriber or -1 if untracked. |
int |
getBufferSize()
Return the processor buffer capacity if any or
Integer.MAX_VALUE |
Throwable |
getError()
Current error if any, default to null
|
boolean |
hasCompleted()
Return true if terminated with onComplete
|
boolean |
hasDownstreams()
Return true if any
Subscriber is actively subscribed |
boolean |
hasError()
Return true if terminated with onError
|
Stream<? extends Scannable> |
inners()
Return a
Stream of referenced inners (flatmap, multicast etc) |
boolean |
isSerialized()
Return true if this
FluxProcessor supports multithread producing |
boolean |
isTerminated()
Has this upstream finished or "completed" / "failed" ?
|
Object |
scanUnsafe(Scannable.Attr key)
This method is used internally by components to define their key-value mappings
in a single place.
|
FluxProcessor<IN,OUT> |
serialize()
Create a
FluxProcessor that safely gates multi-threaded producer
Subscriber.onNext(Object). |
protected boolean |
serializeAlways()
Returns serialization strategy.
|
FluxSink<IN> |
sink()
Create a
FluxSink that safely gates multi-threaded producer
Subscriber.onNext(Object). |
FluxSink<IN> |
sink(FluxSink.OverflowStrategy strategy)
Create a
FluxSink that safely gates multi-threaded producer
Subscriber.onNext(Object). |
static <T> FluxProcessor<Publisher<? extends T>,T> |
switchOnNext()
Build a
FluxProcessor whose data are emitted by the most recent emitted Publisher. |
static <IN,OUT> FluxProcessor<IN,OUT> |
wrap(Subscriber<IN> upstream,
Publisher<OUT> downstream)
|
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, count, create, create, defaultIfEmpty, defer, 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, 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, hide, ignoreElements, index, index, interval, interval, interval, interval, join, just, just, last, last, limitRate, limitRate, limitRequest, log, log, log, log, log, log, map, materialize, merge, merge, merge, merge, merge, merge, mergeDelayError, mergeOrdered, mergeOrdered, mergeOrdered, mergeOrderedWith, 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, 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, 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, takeLast, takeUntil, takeUntilOther, takeWhile, then, then, thenEmpty, thenMany, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timestamp, timestamp, toIterable, toIterable, toIterable, toStream, toStream, toString, transform, transformDeferred, using, using, usingWhen, usingWhen, window, window, window, window, window, window, window, 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, zipWithIterableclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitonSubscribeonComplete, onError, onNextactuals, from, isScanAvailable, name, parents, scan, scanOrDefault, stepName, steps, tagsisDisposedpublic Context currentContext()
CoreSubscriberContext from dependent components which can include downstream
operators during subscribing or a terminal Subscriber.currentContext in interface CoreSubscriber<IN>Context.empty()public void dispose()
DisposableImplementations are required to make this method idempotent.
dispose in interface Disposablepublic long downstreamCount()
Subscriber or -1 if untracked.Subscriber or -1 if untrackedpublic int getBufferSize()
Integer.MAX_VALUEInteger.MAX_VALUE@Nullable public Throwable getError()
public final boolean hasCompleted()
public boolean hasDownstreams()
Subscriber is actively subscribedSubscriber is actively subscribedpublic final boolean hasError()
public Stream<? extends Scannable> inners()
ScannableStream of referenced inners (flatmap, multicast etc)public boolean isSerialized()
FluxProcessor supports multithread producingFluxProcessor supports multithread producingpublic boolean isTerminated()
@Nullable public Object scanUnsafe(Scannable.Attr key)
ScannableScannable.Attr key,
implementors should take care to return values of the correct type, and return
null if no specific value is available.
For public consumption of attributes, prefer using Scannable.scan(Attr), which will
return a typed value and fall back to the key's default if the component didn't
define any mapping.
scanUnsafe in interface Scannablekey - a Scannable.Attr to resolve for the component.public final FluxProcessor<IN,OUT> serialize()
FluxProcessor that safely gates multi-threaded producer
Subscriber.onNext(Object).FluxProcessorPublisher (if any) when it cancels subscription to said source.protected boolean serializeAlways()
sink() will always
be serialized. Otherwise sink is serialized only if FluxSink.onRequest(java.util.function.LongConsumer)
is invoked.public final FluxSink<IN> sink()
FluxSink that safely gates multi-threaded producer
Subscriber.onNext(Object). This processor will be subscribed to
that FluxSink, and any previous subscribers will be unsubscribed.
The returned FluxSink will not apply any
FluxSink.OverflowStrategy and overflowing FluxSink.next(Object)
will behave in two possible ways depending on the Processor:
FluxSinkpublic final FluxSink<IN> sink(FluxSink.OverflowStrategy strategy)
FluxSink that safely gates multi-threaded producer
Subscriber.onNext(Object). This processor will be subscribed to
that FluxSink, and any previous subscribers will be unsubscribed.
The returned FluxSink will not apply any
FluxSink.OverflowStrategy and overflowing FluxSink.next(Object)
will behave in two possible ways depending on the Processor:
strategy - the overflow strategy, see FluxSink.OverflowStrategy
for the
available strategiesFluxSinkpublic static <T> FluxProcessor<Publisher<? extends T>,T> switchOnNext()
FluxProcessor whose data are emitted by the most recent emitted Publisher.
The Flux will complete once both the publishers source and the last switched to Publisher have
completed.

T - the produced typeFluxProcessor accepting publishers and producing Tpublic static <IN,OUT> FluxProcessor<IN,OUT> wrap(Subscriber<IN> upstream, Publisher<OUT> downstream)
Subscriber and a producing Publisher in a logical FluxProcessor.
The link between the passed upstream and returned downstream will not be created automatically, e.g. not
subscribed together. A Processor might choose to have orthogonal sequence input and output.IN - the receiving typeOUT - the producing typeupstream - the upstream subscriberdownstream - the downstream publisherFluxProcessor