THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
/** * RateLimitingStrategy is consulted before sending a request in AsyncSinkWriter to decide if a request should be sent. */ public interface RateLimitingStrategy { /** * Tracks the information of requests being sent (e.g. to track the current inFlightMessages / requests) * @param requestInfo Data class containing information on request being sent */ void startedRequest(RequestInfo requestInfo); /** * Tracks the information of requests completing (e.g. to track the current inFlightMessages / requests). * Any dynamic scaling on failed requests should be done here too. * @param requestInfo Data class containing information on request completed */ void completedRequest(RequestInfo requestInfo); /** * Decides whether the next request should be sentblocked. * @param requestInfo Data class containing information on request being sent */ boolean shouldBlock(RequestInfo requestInfo); /** * Returns the max batch size to be used by the AsyncSinkWriter. */ int getMaxBatchSize(); } /** * This data class encapsulates the information of starting / completing requests. */ public final class RequestInfo { public int failedMessages; public int batchSize; public long requestStartTime; } |
...
To make it easier for sink implementers, we will also provide two an out-of-the box implementations implementation of CongestionControlRateLimitingStrategy, which uses the current AIMDStrategy to control in-flight messages. This mimics the existing behaviour of the AsyncSink.
...