Interface PublishRateLimiter

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void checkPublishRate()
      checks and update state of current publish and marks if it has exceeded the rate-limiting threshold.
      void close()
      Close the limiter.
      void incrementPublishCount​(int numOfMessages, long msgSizeInBytes)
      increments current publish count.
      boolean isPublishRateExceeded()
      returns true if current publish has reached the rate-limiting threshold.
      boolean resetPublishCount()
      reset current publish count.
      boolean tryAcquire​(int numbers, long bytes)
      try to acquire permit.
      void update​(org.apache.pulsar.common.policies.data.Policies policies, java.lang.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.
    • Method Detail

      • 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,
                    java.lang.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 java.lang.AutoCloseable