Top Description Inners Fields Constructors Methods
reactor.core.publisher

public final Class ReplayProcessor<T>

extends FluxProcessor<T, T>
implements Fuseable, InternalManySink<T>
Class Inheritance
All Implemented Interfaces
reactor.core.publisher.InternalManySink, reactor.core.publisher.ContextHolder, reactor.core.publisher.Sinks.Many, reactor.core.Scannable, reactor.core.Fuseable
Annotations
@Deprecated
Type Parameters
<T>
the value type
Imports
java.time.Duration, java.util.Objects, java.util.concurrent.atomic.AtomicIntegerFieldUpdater, .AtomicLongFieldUpdater, .AtomicReferenceFieldUpdater, java.util.stream.Stream, org.reactivestreams.Subscriber, .Subscription, reactor.core.CoreSubscriber, .Fuseable, .Scannable, reactor.core.publisher.Sinks.EmitResult, reactor.core.scheduler.Scheduler, .Schedulers, reactor.util.annotation.Nullable, reactor.util.concurrent.Queues, reactor.util.context.Context

Deprecated

To be removed in 3.5, prefer clear cut usage of Sinks through variations under Sinks.many().replay().

Replays all or the last N items to Subscribers.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final FluxReplay.ReplayBuffer<T>
pack-priv volatile FluxReplay.ReplaySubscription<T>[]
pack-priv static final AtomicReferenceFieldUpdater<ReplayProcessor<T>, FluxReplay.ReplaySubscription<T>[]>
pack-priv Subscription

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
public Flux<T>
asFlux()

Implements reactor.core.publisher.Sinks.Many.asFlux.

Return a Flux view of this sink.
public static <
the type of the pushed elements
T
>
ReplayProcessor<T>

Returns:

a new ReplayProcessor that replays its last pushed element to each new Subscriber
cacheLast
()

Deprecated use Sinks.many().replay().latest() (or the unsafe variant if you're sure about external synchronization).
Create a ReplayProcessor that caches the last element it has pushed, replaying it to late subscribers.
public static <
the type of the pushed elements
T
>
ReplayProcessor<T>

Returns:

a new ReplayProcessor that replays its last pushed element to each new Subscriber, or a default one if nothing was pushed yet
cacheLastOrDefault
(T
a default value to start the sequence with in case nothing has been cached yet.
value
)

Deprecated use Sinks.many().replay().latestOrDefault(value) (or the unsafe variant if you're sure about external synchronization).
Create a ReplayProcessor that caches the last element it has pushed, replaying it to late subscribers.
public static <
the type of the pushed elements
E
>
ReplayProcessor<E>

Returns:

a new ReplayProcessor that replays the whole history to each new Subscriber.
create
()

Deprecated use Sinks.many().replay().all() (or the unsafe variant if you're sure about external synchronization).
Create a new ReplayProcessor that replays an unbounded number of elements, using a default internal Queue.
public static <
the type of the pushed elements
E
>
ReplayProcessor<E>

Returns:

a new ReplayProcessor that replays a limited history to each new Subscriber.
create
(int
the backlog size, ie. maximum items retained for replay.
historySize
)

Deprecated use Sinks.many().replay().limit(historySize) (or the unsafe variant if you're sure about external synchronization).
Create a new ReplayProcessor that replays up to historySize elements.
public static <
the type of the pushed elements
E
>
ReplayProcessor<E>

Returns:

a new ReplayProcessor that replays the whole history to each new Subscriber if configured as unbounded, a limited history otherwise.
create
(int
maximum items retained if bounded, or initial link size if unbounded
historySize
,
boolean
true if "unlimited" data store must be supplied
unbounded
)

Deprecated use Sinks.many().replay().limit(historySize) for bounded cases (unbounded == false) or Sinks.many().replay().all(bufferSize) otherwise (or the unsafe variant if you're sure about external synchronization).
Create a new ReplayProcessor that either replay all the elements or a limited amount of elements depending on the unbounded parameter.
public static <
the type of items observed and emitted by the Processor
T
>
ReplayProcessor<T>

Returns:

a new ReplayProcessor that replay up to size elements, but will evict them from its history based on their age.
createSizeAndTimeout
(int
the maximum number of buffered items
size
,
Duration
the maximum age of the contained items
maxAge
)

Deprecated use Sinks.many().replay().limit(size, maxAge) (or the unsafe variant if you're sure about external synchronization).
Creates a time- and size-bounded replay processor.
public static <
the type of items observed and emitted by the Processor
T
>
ReplayProcessor<T>

Returns:

a new ReplayProcessor that replay up to size elements, but will evict them from its history based on their age.
createSizeAndTimeout
(int
the maximum number of buffered items
size
,
Duration
the maximum age of the contained items in milliseconds
maxAge
,
Scheduler
the Scheduler that provides the current time
scheduler
)

Deprecated use Sinks.many().replay().limit(size, maxAge, scheduler) (or the unsafe variant if you're sure about external synchronization).
Creates a time- and size-bounded replay processor.
public static <
the type of items observed and emitted by the Processor
T
>
ReplayProcessor<T>

Returns:

a new ReplayProcessor that replays elements based on their age.
createTimeout
(Duration
the maximum age of the contained items
maxAge
)

Deprecated use Sinks.many().replay().limit(maxAge) (or the unsafe variant if you're sure about external synchronization).
Creates a time-bounded replay processor.
public static <
the type of items observed and emitted by the Processor
T
>
ReplayProcessor<T>

Returns:

a new ReplayProcessor that replays elements based on their age.
createTimeout
(Duration
the maximum age of the contained items
maxAge
,
Scheduler scheduler)

Deprecated use Sinks.many().replay().limit(maxAge, scheduler) (or the unsafe variant if you're sure about external synchronization).
Creates a time-bounded replay processor.
public Context
currentContext()

Overrides reactor.core.publisher.FluxProcessor.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 int
currentSubscriberCount()

Implements reactor.core.publisher.Sinks.Many.currentSubscriberCount.

Get how many Subscribers are currently subscribed to the sink.
public long
downstreamCount()

Overrides reactor.core.publisher.FluxProcessor.downstreamCount.

Return the number of active Subscriber or -1 if untracked.
public Throwable
getError()

Overrides reactor.core.publisher.FluxProcessor.getError.

Current error if any, default to null
public int
getPrefetch()

Overrides reactor.core.publisher.Flux.getPrefetch.

The prefetch configuration of the Flux
public Stream<? extends Scannable>
inners()

Overrides reactor.core.publisher.FluxProcessor.inners.

Overrides default reactor.core.Scannable.inners.

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

Overrides reactor.core.publisher.FluxProcessor.isTerminated.

Has this upstream finished or "completed" / "failed" ?
public void
onComplete()

Implements org.reactivestreams.Subscriber.onComplete.

Successful terminal state.
public void
onError(Throwable
the throwable signaled
throwable
)

Implements org.reactivestreams.Subscriber.onError.

Failed terminal state.
public void
onNext(T
the element signaled
t
)

Implements org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).
public void
onSubscribe(Subscription
the Subscription that allows requesting data via Subscription#request(long)
s
)

Implements org.reactivestreams.Subscriber.onSubscribe, reactor.core.CoreSubscriber.onSubscribe.

Implementors should initialize any state used by onNext(Object) before calling Subscription#request(long).
pack-priv void
public Object
scanUnsafe(Scannable.Attr<T>
a Attr to resolve for the component.
key
)

Overrides reactor.core.publisher.FluxProcessor.scanUnsafe.

Implements reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place.
public void
subscribe(CoreSubscriber<? super T>
the Subscriber interested into the published sequence
actual
)

Implements abstract reactor.core.publisher.Flux.subscribe.

Implements reactor.core.CorePublisher.subscribe.

An internal Publisher#subscribe(Subscriber) that will bypass Hooks#onLastOperator(Function) pointcut.
public Sinks.EmitResult
tryEmitComplete()

Implements reactor.core.publisher.Sinks.Many.tryEmitComplete.

Try to terminate the sequence successfully, generating an onComplete signal.
public Sinks.EmitResult
tryEmitError(Throwable
the exception to signal, not null
t
)

Implements reactor.core.publisher.Sinks.Many.tryEmitError.

Try to fail the sequence, generating an onError signal.
public Sinks.EmitResult
tryEmitNext(T
the value to emit, not null
t
)

Implements reactor.core.publisher.Sinks.Many.tryEmitNext.

Try emitting a non-null element, generating an onNext signal.
Inherited from reactor.core.publisher.FluxProcessor:
disposegetBufferSizehasCompletedhasDownstreamshasErrorisSerializedserializeserializeAlwayssinksinkswitchOnNextwrap