Interface RateLimitingStrategy

All Known Implementing Classes:
CongestionControlRateLimitingStrategy

@PublicEvolving public interface RateLimitingStrategy
RateLimitingStrategy is used to control the rate of requests. It is given data using register methods registerInFlightRequest(RequestInfo) and registerCompletedRequest(ResultInfo). It will then use that information to make a decision to whether a given request should be blocked or allowed through.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the current max batch size that RateLimitingStrategy will allow through.
    void
    Registers the result of completed requests (e.g. to track the current inFlightMessages / requests).
    void
    Registers the information of requests being sent (e.g. to track the current inFlightMessages / requests).
    boolean
    shouldBlock(RequestInfo requestInfo)
    Decides whether the next request should be blocked.
  • Method Details

    • registerInFlightRequest

      void registerInFlightRequest(RequestInfo requestInfo)
      Registers the information of requests being sent (e.g. to track the current inFlightMessages / requests).
      Parameters:
      requestInfo - Data class containing information on request being sent
    • registerCompletedRequest

      void registerCompletedRequest(ResultInfo resultInfo)
      Registers the result of completed requests (e.g. to track the current inFlightMessages / requests). Any dynamic scaling on failed messages should be done here.
      Parameters:
      resultInfo - Data class containing information on request completed
    • shouldBlock

      boolean shouldBlock(RequestInfo requestInfo)
      Decides whether the next request should be blocked.
      Parameters:
      requestInfo - Data class containing information on request being sent
    • getMaxBatchSize

      int getMaxBatchSize()
      Returns the current max batch size that RateLimitingStrategy will allow through. This is required so that the component that constructs the ResultInfo that is passed into shouldBlock(RequestInfo) can construct a passable ResultInfo.