Class ReplayStrategyBuilder<T>

java.lang.Object
io.servicetalk.concurrent.api.ReplayStrategyBuilder<T>
Type Parameters:
T - The type of data for ReplayStrategy.

public final class ReplayStrategyBuilder<T> extends Object
A builder of ReplayStrategy.
  • Constructor Details

    • ReplayStrategyBuilder

      public ReplayStrategyBuilder(Supplier<ReplayAccumulator<T>> accumulatorSupplier)
      Create a new instance.
      Parameters:
      accumulatorSupplier - provides the ReplayAccumulator to use on each subscribe to upstream.
  • Method Details

    • minSubscribers

      public ReplayStrategyBuilder<T> minSubscribers(int 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

      public ReplayStrategyBuilder<T> cancelUpstream(boolean 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

      public ReplayStrategyBuilder<T> queueLimitHint(int queueLimitHint)
      Set 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.
      Parameters:
      queueLimitHint - 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.
      Returns:
      this.
    • terminalResubscribe

      public ReplayStrategyBuilder<T> terminalResubscribe(Function<Throwable,Completable> terminalResubscribe)
      Set a Function that is invoked when a terminal signal arrives from upstream and determines when state is reset to allow for upstream resubscribe.
      Parameters:
      terminalResubscribe - A Function that is invoked when a terminal signal arrives from upstream, and returns a Completable whose termination resets the state of the returned Publisher and allows for downstream resubscribing. The argument to this function is as follows:
      Returns:
      this.
    • build

      public ReplayStrategy<T> build()
      Build the ReplayStrategy.
      Returns:
      the ReplayStrategy.