Top Description Fields Constructors Methods
reactor.core.publisher

public abstract Class FluxProcessor<IN, OUT>

extends Flux<OUT>
implements Processor<IN, OUT>, CoreSubscriber<IN>, Scannable, Disposable, ContextHolder
Class Inheritance
All Implemented Interfaces
reactor.core.publisher.ContextHolder, reactor.core.Disposable, reactor.core.Scannable, reactor.core.CoreSubscriber, org.reactivestreams.Subscriber, org.reactivestreams.Processor, org.reactivestreams.Publisher
Known Direct Subclasses
reactor.core.publisher.ReplayProcessor, reactor.core.publisher.DirectProcessor, reactor.core.publisher.EmitterProcessor, reactor.core.publisher.UnicastProcessor, reactor.core.publisher.DelegateProcessor
Annotations
@Deprecated
Type Parameters
<IN>
the input value type
<OUT>
the output value type
Imports
java.util.Objects, java.util.concurrent.CancellationException, java.util.stream.Stream, org.reactivestreams.Processor, .Publisher, .Subscriber, reactor.core.CoreSubscriber, .Disposable, .Scannable, reactor.util.annotation.Nullable, reactor.util.context.Context

Deprecated

Processors will be removed in 3.5. Prefer using Many instead, or see https://github.com/reactor/reactor-core/issues/2431 for alternatives

A base processor that exposes Flux API for Processor. Implementors include UnicastProcessor, EmitterProcessor, ReplayProcessor.
Author
Stephane Maldini

Field Summary

Inherited from reactor.core.publisher.Flux:
ALWAYS_BOOLEAN_SUPPLIERIDENTITY_FUNCTIONLIST_SUPPLIEROBJECT_EQUALSET_SUPPLIERTUPLE2_BIFUNCTION

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Context
currentContext()

Overrides default reactor.core.CoreSubscriber.currentContext.

Implements reactor.core.publisher.ContextHolder.currentContext.

Request a Context from dependent components which can include downstream operators during subscribing or a terminal org.reactivestreams.Subscriber.
public void
dispose()

Implements reactor.core.Disposable.dispose.

Cancel or dispose the underlying task or resource.
public long

Returns:

the number of active Subscriber or -1 if untracked
downstreamCount
()

Return the number of active Subscriber or -1 if untracked.

public int

Returns:

processor buffer capacity if any or Integer#MAX_VALUE
getBufferSize
()

Return the processor buffer capacity if any or Integer#MAX_VALUE

public Throwable

Returns:

Current error if any, default to null
getError
()

Current error if any, default to null

public final boolean

Returns:

true if terminated with onComplete
hasCompleted
()

Return true if terminated with onComplete

public boolean

Returns:

true if any Subscriber is actively subscribed
hasDownstreams
()

Return true if any Subscriber is actively subscribed

public final boolean

Returns:

true if terminated with onError
hasError
()

Return true if terminated with onError

public Stream<? extends Scannable>
inners()

Overrides default reactor.core.Scannable.inners.

Return a Stream of referenced inners (flatmap, multicast etc)
protected boolean

Returns:

true if FluxProcessor<T, T>
isIdentityProcessor
()

Return true if FluxProcessor<T, T>

public boolean

Returns:

true if this FluxProcessor supports multithread producing
isSerialized
()

Return true if this FluxProcessor supports multithread producing

public boolean

Returns:

has this upstream finished or "completed" / "failed" ?
isTerminated
()

Has this upstream finished or "completed" / "failed" ?

public Object
scanUnsafe(Scannable.Attr<T>
a Attr to resolve for the component.
key
)

Implements reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place.
public final FluxProcessor<IN, OUT>

Returns:

a serializing FluxProcessor
serialize
()

Deprecated as a consequence of FluxProcessor being deprecated.
Create a FluxProcessor that safely gates multi-threaded producer Subscriber#onNext(Object).
protected boolean

Returns:

true to serialize any sink, false to delay serialization till onRequest
serializeAlways
()

Returns serialization strategy.

public final FluxSink<IN>

Returns:

a serializing FluxSink
sink
()

Deprecated To be removed in 3.5, prefer clear cut usage of Sinks through the Sinks#many() spec.
Create a FluxSink that safely gates multi-threaded producer Subscriber#onNext(Object).
public final FluxSink<IN>

Returns:

a serializing FluxSink
sink
(FluxSink.OverflowStrategy
the overflow strategy, see FluxSink.OverflowStrategy for the available strategies
strategy
)

Deprecated To be removed in 3.5, prefer clear cut usage of Sinks through the Sinks#many() spec.
Create a FluxSink that safely gates multi-threaded producer Subscriber#onNext(Object).
public static <
the produced type
T
>
FluxProcessor<Publisher<? extends T>, T>

Returns:

a FluxProcessor accepting publishers and producing T
switchOnNext
()

Deprecated should use Sinks, Many#asFlux() and Flux#switchOnNext(Publisher).
Build a FluxProcessor whose data are emitted by the most recent emitted Publisher.
public static <
the receiving type
IN
,
the producing type
OUT
>
FluxProcessor<IN, OUT>

Returns:

a new blackboxed FluxProcessor
wrap
(final Subscriber<IN>
the upstream subscriber
upstream
,
final Publisher<OUT>
the downstream publisher
downstream
)

Deprecated as a consequence of FluxProcessor being deprecated.
Transform a receiving Subscriber and a producing Publisher in a logical FluxProcessor.
Inherited from reactor.core.publisher.Flux:
allanyasblockFirstblockFirstblockLastblockLastbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferTimeoutbufferTimeoutbufferTimeoutbufferTimeoutbufferTimeoutbufferTimeoutbufferTimeoutbufferTimeoutbufferUntilbufferUntilbufferUntilChangedbufferUntilChangedbufferUntilChangedbufferWhenbufferWhenbufferWhilecachecachecachecachecachecachecancelOncastcheckpointcheckpointcheckpointcollectcollectcollectListcollectMapcollectMapcollectMapcollectMultimapcollectMultimapcollectMultimapcollectSortedListcollectSortedListcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestconcatconcatconcatconcatconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatMapconcatMapconcatMapDelayErrorconcatMapDelayErrorconcatMapDelayErrorconcatMapIterableconcatMapIterableconcatWithconcatWithValuescontextCapturecontextWritecontextWritecountcountingBooleanSuppliercountingPredicatecreatecreatedefaultIfEmptydeferdeferContextualdelayElementsdelayElementsdelaySequencedelaySequencedelaySubscriptiondelaySubscriptiondelaySubscriptiondelayUntildematerializedistinctdistinctdistinctdistinctdistinctUntilChangeddistinctUntilChangeddistinctUntilChangeddoAfterTerminatedoFinallydoFirstdoOnCanceldoOnCompletedoOnDiscarddoOnEachdoOnErrordoOnErrordoOnErrordoOnNextdoOnRequestdoOnSignaldoOnSubscribedoOnTerminateelapsedelapsedelementAtelementAtemptyequalPredicateerrorerrorerrorexpandexpandexpandDeepexpandDeepfilterfilterWhenfilterWhenfirstfirstfirstWithSignalfirstWithSignalfirstWithValuefirstWithValueflatMapflatMapflatMapflatMapflatMapflatMapDelayErrorflatMapIterableflatMapIterableflatMapSequentialflatMapSequentialflatMapSequentialflatMapSequentialflatMapSequentialDelayErrorfromfromArrayfromIterablefromStreamfromStreamgenerategenerategenerategetPrefetchgroupBygroupBygroupBygroupBygroupJoinhandlehasElementhasElementshashSetSupplierhideidentityFunctionignoreElementsindexindexintervalintervalintervalintervaljoinjustjustlastlastlimitRatelimitRatelimitRequestlistSupplierloglogloglogloglogmapmapNotNullmaterializemergemergemergemergemergemergemergemergeComparingmergeComparingmergeComparingmergeComparingDelayErrormergeComparingWithmergeDelayErrormergeOrderedmergeOrderedmergeOrderedmergeOrderedWithmergePrioritymergePrioritymergePrioritymergePriorityDelayErrormergeSequentialmergeSequentialmergeSequentialmergeSequentialmergeSequentialmergeSequentialmergeSequentialmergeSequentialmergeSequentialmergeSequentialDelayErrormergeSequentialDelayErrormergeSequentialDelayErrormergeWithmetricsnamenevernextofTypeonAssemblyonAssemblyonBackpressureBufferonBackpressureBufferonBackpressureBufferonBackpressureBufferonBackpressureBufferonBackpressureBufferonBackpressureBufferonBackpressureDroponBackpressureDroponBackpressureErroronBackpressureLatestonErrorCompleteonErrorCompleteonErrorCompleteonErrorContinueonErrorContinueonErrorContinueonErrorMaponErrorMaponErrorMaponErrorResumeonErrorResumeonErrorResumeonErrorReturnonErrorReturnonErrorReturnonErrorStoponTerminateDetachorparallelparallelparallelpublishpublishpublishpublishpublishNextpublishOnpublishOnpublishOnpublishOnpushpushrangereducereducereduceWithrepeatrepeatrepeatrepeatrepeatWhenreplayreplayreplayreplayreplayreplayretryretryretryWhensamplesamplesampleFirstsampleFirstsampleTimeoutsampleTimeoutscanscanscanWithshareshareNextsinglesinglesingleOrEmptyskipskipskipskipLastskipUntilskipUntilOtherskipWhilesortsortstartWithstartWithstartWithsubscribesubscribesubscribesubscribesubscribesubscribesubscribesubscribesubscribeOnsubscribeOnsubscribeWithswitchIfEmptyswitchMapswitchMapswitchOnFirstswitchOnFirstswitchOnNextswitchOnNexttagtaketaketaketaketakeLasttakeUntiltakeUntilOthertakeWhiletaptaptapthenthenthenEmptythenManytimedtimedtimeouttimeouttimeouttimeouttimeouttimeouttimeouttimestamptimestamptoIterabletoIterabletoIterabletoStreamtoStreamtoStringtransformtransformDeferredtransformDeferredContextualtuple2FunctionusingusingusingWhenusingWhenwindowwindowwindowwindowwindowwindowwindowwindowTimeoutwindowTimeoutwindowTimeoutwindowTimeoutwindowUntilwindowUntilwindowUntilwindowUntilChangedwindowUntilChangedwindowUntilChangedwindowWhenwindowWhilewindowWhilewithLatestFromwrapwrapToMonozipzipzipzipzipzipzipzipzipzipzipzipzipzipWithzipWithzipWithzipWithzipWithIterablezipWithIterable

Constructor Detail

FluxProcessorback to summary
public FluxProcessor()

Method Detail

currentContextback to summary
public Context currentContext()

Overrides default reactor.core.CoreSubscriber.currentContext.

Implements reactor.core.publisher.ContextHolder.currentContext.

Doc from reactor.core.CoreSubscriber.currentContext.

Request a Context from dependent components which can include downstream operators during subscribing or a terminal org.reactivestreams.Subscriber.

Returns:Context

a resolved context or Context#empty()

Annotations
@Override
disposeback to summary
public void dispose()

Implements reactor.core.Disposable.dispose.

Doc from reactor.core.Disposable.dispose.

Cancel or dispose the underlying task or resource.

Implementations are required to make this method idempotent.

Annotations
@Override
downstreamCountback to summary
public long downstreamCount()

Return the number of active Subscriber or -1 if untracked.

Returns:long

the number of active Subscriber or -1 if untracked

getBufferSizeback to summary
public int getBufferSize()

Return the processor buffer capacity if any or Integer#MAX_VALUE

Returns:int

processor buffer capacity if any or Integer#MAX_VALUE

getErrorback to summary
public Throwable getError()

Current error if any, default to null

Returns:Throwable

Current error if any, default to null

Annotations
@Nullable
hasCompletedback to summary
public final boolean hasCompleted()

Return true if terminated with onComplete

Returns:boolean

true if terminated with onComplete

hasDownstreamsback to summary
public boolean hasDownstreams()

Return true if any Subscriber is actively subscribed

Returns:boolean

true if any Subscriber is actively subscribed

hasErrorback to summary
public final boolean hasError()

Return true if terminated with onError

Returns:boolean

true if terminated with onError

innersback to summary
public Stream<? extends Scannable> inners()

Overrides default reactor.core.Scannable.inners.

Doc from reactor.core.Scannable.inners.

Return a Stream of referenced inners (flatmap, multicast etc)

Returns:Stream<? extends Scannable>

a Stream of referenced inners (flatmap, multicast etc)

Annotations
@Override
isIdentityProcessorback to summary
protected boolean isIdentityProcessor()

Return true if FluxProcessor<T, T>

Returns:boolean

true if FluxProcessor<T, T>

isSerializedback to summary
public boolean isSerialized()

Return true if this FluxProcessor supports multithread producing

Returns:boolean

true if this FluxProcessor supports multithread producing

isTerminatedback to summary
public boolean isTerminated()

Has this upstream finished or "completed" / "failed" ?

Returns:boolean

has this upstream finished or "completed" / "failed" ?

scanUnsafeback to summary
public Object scanUnsafe(Scannable.Attr<T> key)

Implements reactor.core.Scannable.scanUnsafe.

Doc from reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place. Although it is ignoring the generic type of the 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 scan(Attr), which will return a typed value and fall back to the key's default if the component didn't define any mapping.

Parameters
key:Scannable.Attr<T>

a Attr to resolve for the component.

Returns:Object

the value associated to the key for that specific component, or null if none.

Annotations
@Override
@Nullable
serializeback to summary
public final FluxProcessor<IN, OUT> serialize()

Deprecated

as a consequence of FluxProcessor being deprecated. See corresponding docs for further information.

Create a FluxProcessor that safely gates multi-threaded producer Subscriber#onNext(Object).

Discard Support: The resulting processor discards elements received from the source Publisher (if any) when it cancels subscription to said source.

Returns:FluxProcessor<IN, OUT>

a serializing FluxProcessor

serializeAlwaysback to summary
protected boolean serializeAlways()

Returns serialization strategy. If true, FluxProcessor#sink() will always be serialized. Otherwise sink is serialized only if FluxSink#onRequest(java.util.function.LongConsumer) is invoked.

Returns:boolean

true to serialize any sink, false to delay serialization till onRequest

sinkback to summary
public final FluxSink<IN> sink()

Deprecated

To be removed in 3.5, prefer clear cut usage of Sinks through the Sinks#many() spec.

Create a 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:

  • an unbounded processor will handle the overflow itself by dropping or buffering
  • a bounded processor will block/spin
Returns:FluxSink<IN>

a serializing FluxSink

Annotations
@Deprecated
sinkback to summary
public final FluxSink<IN> sink(FluxSink.OverflowStrategy strategy)

Deprecated

To be removed in 3.5, prefer clear cut usage of Sinks through the Sinks#many() spec.

Create a 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:

  • an unbounded processor will handle the overflow itself by dropping or buffering
  • a bounded processor will block/spin on IGNORE strategy, or apply the strategy behavior
Parameters
strategy:FluxSink.OverflowStrategy

the overflow strategy, see FluxSink.OverflowStrategy for the available strategies

Returns:FluxSink<IN>

a serializing FluxSink

Annotations
@Deprecated
switchOnNextback to summary
public static <T> FluxProcessor<Publisher<? extends T>, T> switchOnNext()

Deprecated

should use Sinks, Many#asFlux() and Flux#switchOnNext(Publisher). To be removed in 3.5.0.

Build a 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.

Parameters
<T>
the produced type
Returns:FluxProcessor<Publisher<? extends T>, T>

a FluxProcessor accepting publishers and producing T

Annotations
@Deprecated
wrapback to summary
public static <IN, OUT> FluxProcessor<IN, OUT> wrap(final Subscriber<IN> upstream, final Publisher<OUT> downstream)

Deprecated

as a consequence of FluxProcessor being deprecated. See corresponding docs for further information.

Transform a receiving 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.

Parameters
<IN>
the receiving type
<OUT>
the producing type
upstream:Subscriber<IN>

the upstream subscriber

downstream:Publisher<OUT>

the downstream publisher

Returns:FluxProcessor<IN, OUT>

a new blackboxed FluxProcessor