Class MaxInFlightRequestStrategy

  • All Implemented Interfaces:
    RequestStrategy

    public abstract class MaxInFlightRequestStrategy
    extends java.lang.Object
    implements RequestStrategy
    Requests up to the max and also takes the number of messages that have been queued internally or delegated to other actors into account. Concrete subclass must implement inFlightInternally(). It will request elements in minimum batches of the defined batchSize().
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      int batchSize()
      Elements will be requested in minimum batches of this size.
      abstract int inFlightInternally()
      Concrete subclass must implement this method to define how many messages that are currently in progress or queued.
      int requestDemand​(int remainingRequested)
      Invoked by the ActorSubscriber after each incoming message to determine how many more elements to request from the stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MaxInFlightRequestStrategy

        public MaxInFlightRequestStrategy​(int max)
    • Method Detail

      • batchSize

        public int batchSize()
        Elements will be requested in minimum batches of this size. Default is 5. Subclass may override to define the batch size.
        Returns:
        (undocumented)
      • inFlightInternally

        public abstract int inFlightInternally()
        Concrete subclass must implement this method to define how many messages that are currently in progress or queued.
        Returns:
        (undocumented)
      • requestDemand

        public int requestDemand​(int remainingRequested)
        Description copied from interface: RequestStrategy
        Invoked by the ActorSubscriber after each incoming message to determine how many more elements to request from the stream.

        Specified by:
        requestDemand in interface RequestStrategy
        Parameters:
        remainingRequested - current remaining number of elements that have been requested from upstream but not received yet
        Returns:
        demand of more elements from the stream, returning 0 means that no more elements will be requested for now