Interface RateLimiterStrategy
-
- All Superinterfaces:
Serializable
@Experimental public interface RateLimiterStrategy extends Serializable
A factory forRateLimiterswhich apply rate-limiting to a source sub-task.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description RateLimitercreateRateLimiter(int parallelism)Creates aRateLimiterthat lets records through with rate proportional to the parallelism.static RateLimiterStrategynoOp()Creates a convenienceRateLimiterStrategythat is not limiting the records rate.static RateLimiterStrategyperCheckpoint(int recordsPerCheckpoint)Creates aRateLimiterStrategythat is limiting the number of records per checkpoint.static RateLimiterStrategyperSecond(double recordsPerSecond)Creates aRateLimiterStrategythat is limiting the number of records per second.
-
-
-
Method Detail
-
createRateLimiter
RateLimiter createRateLimiter(int parallelism)
Creates aRateLimiterthat lets records through with rate proportional to the parallelism. This method will be called once per source subtask. The cumulative rate over all rate limiters for a source must not exceed the rate limit configured for the strategy.
-
perSecond
static RateLimiterStrategy perSecond(double recordsPerSecond)
Creates aRateLimiterStrategythat is limiting the number of records per second.- Parameters:
recordsPerSecond- The number of records produced per second. The actual number of produced records is subject to rounding due to dividing the number of produced records among the parallel instances.
-
perCheckpoint
static RateLimiterStrategy perCheckpoint(int recordsPerCheckpoint)
Creates aRateLimiterStrategythat is limiting the number of records per checkpoint.- Parameters:
recordsPerCheckpoint- The number of records produced per checkpoint. This value has to be greater or equal to parallelism. The actual number of produced records is subject to rounding due to dividing the number of produced records among the parallel instances.
-
noOp
static RateLimiterStrategy noOp()
Creates a convenienceRateLimiterStrategythat is not limiting the records rate.
-
-