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 TypeMethodDescriptionintReturns the current max batch size that RateLimitingStrategy will allow through.voidregisterCompletedRequest(ResultInfo resultInfo) Registers the result of completed requests (e.g. to track the current inFlightMessages / requests).voidregisterInFlightRequest(RequestInfo requestInfo) Registers the information of requests being sent (e.g. to track the current inFlightMessages / requests).booleanshouldBlock(RequestInfo requestInfo) Decides whether the next request should be blocked.
-
Method Details
-
registerInFlightRequest
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
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
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 theResultInfothat is passed intoshouldBlock(RequestInfo)can construct a passableResultInfo.
-