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 aSupplier
that provides theReplayAccumulator
on each upstream subscribe.boolean
Determine if all the downstream subscribers cancel, should upstream be cancelled.int
Get the minimum number of downstream subscribers before subscribing upstream.int
Get 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.Get aFunction
that 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 aSupplier
that provides theReplayAccumulator
on each upstream subscribe.- Returns:
- a
Supplier
that provides theReplayAccumulator
on each upstream subscribe.
-
cancelUpstream
boolean cancelUpstream()Determine if all the downstream subscribers cancel, should upstream be cancelled.- Returns:
true
if all the downstream subscribers cancel, should upstream be cancelled.false
will 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.Subscriber
in 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.Subscriber
in order to compensate for unequal demand and late subscribers.
-
terminalResubscribe
Function<Throwable,Completable> terminalResubscribe()Get aFunction
that is invoked when a terminal signal arrives from upstream and determines when state is reset to allow for upstream resubscribe.- Returns:
- A
Function
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)
-