Interface RateLimitingStrategy
-
- All Known Implementing Classes:
CongestionControlRateLimitingStrategy
@PublicEvolving public interface RateLimitingStrategyRateLimitingStrategy is used to control the rate of requests. It is given data using register methodsregisterInFlightRequest(RequestInfo)andregisterCompletedRequest(ResultInfo). It will then use that information to make a decision to whether a given request should be blocked or allowed through.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetMaxBatchSize()Returns the current max batch size that RateLimitingStrategy will allow through.voidregisterCompletedRequest(ResultInfo resultInfo)Registers the result of completed requests (e.g.voidregisterInFlightRequest(RequestInfo requestInfo)Registers the information of requests being sent (e.g.booleanshouldBlock(RequestInfo requestInfo)Decides whether the next request should be blocked.
-
-
-
Method Detail
-
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 theResultInfothat is passed intoshouldBlock(RequestInfo)can construct a passableResultInfo.
-
-