Interface PublishRateLimiter

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
PrecisPublishLimiter, PublishRateLimiterDisable, PublishRateLimiterImpl, ResourceGroupPublishLimiter

public interface PublishRateLimiter extends AutoCloseable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final PublishRateLimiter
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    checks and update state of current publish and marks if it has exceeded the rate-limiting threshold.
    void
    Close the limiter.
    void
    incrementPublishCount(int numOfMessages, long msgSizeInBytes)
    increments current publish count.
    boolean
    returns true if current publish has reached the rate-limiting threshold.
    boolean
    reset current publish count.
    boolean
    tryAcquire(int numbers, long bytes)
    try to acquire permit.
    void
    update(org.apache.pulsar.common.policies.data.Policies policies, String clusterName)
    updates rate-limiting threshold based on policies.
    void
    update(org.apache.pulsar.common.policies.data.PublishRate maxPublishRate)
    updates rate-limiting threshold based on passed in rate limiter.
  • Field Details

  • Method Details

    • checkPublishRate

      void checkPublishRate()
      checks and update state of current publish and marks if it has exceeded the rate-limiting threshold.
    • incrementPublishCount

      void incrementPublishCount(int numOfMessages, long msgSizeInBytes)
      increments current publish count.
      Parameters:
      numOfMessages -
      msgSizeInBytes -
    • resetPublishCount

      boolean resetPublishCount()
      reset current publish count.
      Returns:
    • isPublishRateExceeded

      boolean isPublishRateExceeded()
      returns true if current publish has reached the rate-limiting threshold.
      Returns:
    • update

      void update(org.apache.pulsar.common.policies.data.Policies policies, String clusterName)
      updates rate-limiting threshold based on policies.
      Parameters:
      policies -
      clusterName -
    • update

      void update(org.apache.pulsar.common.policies.data.PublishRate maxPublishRate)
      updates rate-limiting threshold based on passed in rate limiter.
      Parameters:
      maxPublishRate -
    • tryAcquire

      boolean tryAcquire(int numbers, long bytes)
      try to acquire permit.
      Parameters:
      numbers -
      bytes -
    • close

      void close()
      Close the limiter.
      Specified by:
      close in interface AutoCloseable