Package io.servicetalk.concurrent.api
Class ReplayStrategyBuilder<T>
java.lang.Object
io.servicetalk.concurrent.api.ReplayStrategyBuilder<T>
- Type Parameters:
T
- The type of data forReplayStrategy
.
A builder of
ReplayStrategy
.-
Constructor Summary
ConstructorsConstructorDescriptionReplayStrategyBuilder
(Supplier<ReplayAccumulator<T>> accumulatorSupplier) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build theReplayStrategy
.cancelUpstream
(boolean cancelUpstream) Determine if all the downstream subscribers cancel, should upstream be cancelled.minSubscribers
(int minSubscribers) Set the minimum number of downstream subscribers before subscribing upstream.queueLimitHint
(int queueLimitHint) Set a hint to limit the number of elements which will be queued for eachPublisherSource.Subscriber
in order to compensate for unequal demand and late subscribers.terminalResubscribe
(Function<Throwable, Completable> terminalResubscribe) Set aFunction
that is invoked when a terminal signal arrives from upstream and determines when state is reset to allow for upstream resubscribe.
-
Constructor Details
-
ReplayStrategyBuilder
Create a new instance.- Parameters:
accumulatorSupplier
- provides theReplayAccumulator
to use on each subscribe to upstream.
-
-
Method Details
-
minSubscribers
Set the minimum number of downstream subscribers before subscribing upstream.- Parameters:
minSubscribers
- the minimum number of downstream subscribers before subscribing upstream.- Returns:
this
.
-
cancelUpstream
Determine if all the downstream subscribers cancel, should upstream be cancelled.- Parameters:
cancelUpstream
-true
if all the downstream subscribers cancel, should upstream be cancelled.false
will not cancel upstream if all downstream subscribers cancel.- Returns:
this
.
-
queueLimitHint
Set a hint to limit the number of elements which will be queued for eachPublisherSource.Subscriber
in order to compensate for unequal demand and late subscribers.- Parameters:
queueLimitHint
- a hint to limit the number of elements which will be queued for eachPublisherSource.Subscriber
in order to compensate for unequal demand and late subscribers.- Returns:
this
.
-
terminalResubscribe
public ReplayStrategyBuilder<T> terminalResubscribe(Function<Throwable, Completable> terminalResubscribe) Set aFunction
that is invoked when a terminal signal arrives from upstream and determines when state is reset to allow for upstream resubscribe.- Parameters:
terminalResubscribe
- AFunction
that is invoked when a terminal signal arrives from upstream, and returns aCompletable
whose termination resets the state of the returnedPublisher
and allows for downstream resubscribing. The argument to this function is as follows:null
if upstream terminates withPublisherSource.Subscriber.onComplete()
- otherwise the
Throwable
fromPublisherSource.Subscriber.onError(Throwable)
- Returns:
this
.
-
build
Build theReplayStrategy
.- Returns:
- the
ReplayStrategy
.
-