Class RateLimitPolicyFactory.DefaultRateLimiter
- java.lang.Object
-
- org.apache.beam.sdk.io.aws2.kinesis.RateLimitPolicyFactory.DefaultRateLimiter
-
- All Implemented Interfaces:
RateLimitPolicy
- Enclosing interface:
- RateLimitPolicyFactory
public static class RateLimitPolicyFactory.DefaultRateLimiter extends java.lang.Object implements RateLimitPolicy
Default rate limiter that throttles reading from a shard using an exponential backoff if the response is empty or if the consumer is throttled by AWS.
-
-
Constructor Summary
Constructors Constructor Description DefaultRateLimiter(org.apache.beam.sdk.util.BackOff emptySuccess, org.apache.beam.sdk.util.BackOff throttled)DefaultRateLimiter(org.joda.time.Duration emptySuccessBaseDelay, org.joda.time.Duration throttledBaseDelay, org.joda.time.Duration maxDelay)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonSuccess(java.util.List<KinesisRecord> records)Called after Kinesis records are successfully retrieved.voidonThrottle(KinesisClientThrottledException e)Called after the Kinesis client is throttled.
-
-
-
Constructor Detail
-
DefaultRateLimiter
public DefaultRateLimiter(org.apache.beam.sdk.util.BackOff emptySuccess, org.apache.beam.sdk.util.BackOff throttled)
-
DefaultRateLimiter
public DefaultRateLimiter(org.joda.time.Duration emptySuccessBaseDelay, org.joda.time.Duration throttledBaseDelay, org.joda.time.Duration maxDelay)
-
-
Method Detail
-
onSuccess
public void onSuccess(java.util.List<KinesisRecord> records) throws java.lang.InterruptedException
Description copied from interface:RateLimitPolicyCalled after Kinesis records are successfully retrieved.- Specified by:
onSuccessin interfaceRateLimitPolicy- Parameters:
records- The list of retrieved records.- Throws:
java.lang.InterruptedException
-
onThrottle
public void onThrottle(KinesisClientThrottledException e) throws java.lang.InterruptedException
Description copied from interface:RateLimitPolicyCalled after the Kinesis client is throttled.- Specified by:
onThrottlein interfaceRateLimitPolicy- Parameters:
e- TheKinesisClientThrottledExceptionthrown by the client.- Throws:
java.lang.InterruptedException
-
-