Class 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)  
    • 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: RateLimitPolicy
        Called after Kinesis records are successfully retrieved.
        Specified by:
        onSuccess in interface RateLimitPolicy
        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: RateLimitPolicy
        Called after the Kinesis client is throttled.
        Specified by:
        onThrottle in interface RateLimitPolicy
        Parameters:
        e - The KinesisClientThrottledException thrown by the client.
        Throws:
        java.lang.InterruptedException