Package io.servicetalk.concurrent.api
Interface ReplayStrategy<T>
- Type Parameters:
T- The type of data.
public interface ReplayStrategy<T>
Used to customize the strategy for the
Publisher replay operator.-
Method Summary
Modifier and TypeMethodDescriptionGet aSupplierthat provides theReplayAccumulatoron each upstream subscribe.booleanDetermine if all the downstream subscribers cancel, should upstream be cancelled.intGet the minimum number of downstream subscribers before subscribing upstream.intGet a hint to limit the number of elements which will be queued for eachPublisherSource.Subscriberin order to compensate for unequal demand and late subscribers.Get aFunctionthat is invoked when a terminal signal arrives from upstream and determines when state is reset to allow for upstream resubscribe.
-
Method Details
-
minSubscribers
int minSubscribers()Get the minimum number of downstream subscribers before subscribing upstream.- Returns:
- the minimum number of downstream subscribers before subscribing upstream.
-
accumulatorSupplier
Supplier<ReplayAccumulator<T>> accumulatorSupplier()Get aSupplierthat provides theReplayAccumulatoron each upstream subscribe.- Returns:
- a
Supplierthat provides theReplayAccumulatoron each upstream subscribe.
-
cancelUpstream
boolean cancelUpstream()Determine if all the downstream subscribers cancel, should upstream be cancelled.- Returns:
trueif all the downstream subscribers cancel, should upstream be cancelled.falsewill not cancel upstream if all downstream subscribers cancel.
-
queueLimitHint
int queueLimitHint()Get 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:
- a hint to limit the number of elements which will be queued for each
PublisherSource.Subscriberin order to compensate for unequal demand and late subscribers.
-
terminalResubscribe
Function<Throwable,Completable> terminalResubscribe()Get aFunctionthat is invoked when a terminal signal arrives from upstream and determines when state is reset to allow for upstream resubscribe.- Returns:
- A
Functionthat 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)
-