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.Subscriberin order to compensate for unequal demand and late subscribers.terminalResubscribe(Function<Throwable, Completable> terminalResubscribe) Set aFunctionthat 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 theReplayAccumulatorto 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-trueif all the downstream subscribers cancel, should upstream be cancelled.falsewill 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.Subscriberin 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.Subscriberin order to compensate for unequal demand and late subscribers.- Returns:
this.
-
terminalResubscribe
public ReplayStrategyBuilder<T> terminalResubscribe(Function<Throwable, Completable> terminalResubscribe) Set aFunctionthat is invoked when a terminal signal arrives from upstream and determines when state is reset to allow for upstream resubscribe.- Parameters:
terminalResubscribe- AFunctionthat is invoked when a terminal signal arrives from upstream, and returns aCompletablewhose termination resets the state of the returnedPublisherand allows for downstream resubscribing. The argument to this function is as follows:nullif upstream terminates withPublisherSource.Subscriber.onComplete()- otherwise the
ThrowablefromPublisherSource.Subscriber.onError(Throwable)
- Returns:
this.
-
build
Build theReplayStrategy.- Returns:
- the
ReplayStrategy.
-