Class EnvoyRateLimiter

java.lang.Object
org.apache.beam.sdk.io.components.ratelimiter.EnvoyRateLimiter
All Implemented Interfaces:
Serializable, AutoCloseable, RateLimiter

public class EnvoyRateLimiter extends Object implements RateLimiter
A lightweight handle for an Envoy-based rate limiter.

Delegates work to the EnvoyRateLimiterFactory using the baked-in EnvoyRateLimiterContext.

See Also:
  • Constructor Details

  • Method Details

    • allow

      public boolean allow(int permits) throws IOException, InterruptedException
      Description copied from interface: RateLimiter
      Blocks until the specified number of permits are acquired and returns true if the request was allowed or false if the request was rejected.
      Specified by:
      allow in interface RateLimiter
      Parameters:
      permits - Number of permits to acquire.
      Returns:
      true if the request was allowed, false if it was rejected (and retries exceeded).
      Throws:
      IOException - if there is an error communicating with the rate limiter service.
      InterruptedException - if the thread is interrupted while waiting.
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception