Package org.apache.pulsar.broker.service
Interface PublishRateLimiter
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
PrecisPublishLimiter,PublishRateLimiterDisable,PublishRateLimiterImpl,ResourceGroupPublishLimiter
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidchecks and update state of current publish and marks if it has exceeded the rate-limiting threshold.voidclose()Close the limiter.voidincrementPublishCount(int numOfMessages, long msgSizeInBytes) increments current publish count.booleanreturns true if current publish has reached the rate-limiting threshold.booleanreset current publish count.booleantryAcquire(int numbers, long bytes) try to acquire permit.voidupdates rate-limiting threshold based on policies.voidupdate(org.apache.pulsar.common.policies.data.PublishRate maxPublishRate) updates rate-limiting threshold based on passed in rate limiter.
-
Field Details
-
DISABLED_RATE_LIMITER
-
-
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
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:
closein interfaceAutoCloseable
-