Class TokenBucketThrottlingStrategyBuilder<T extends com.linecorp.armeria.common.Request>
java.lang.Object
com.linecorp.armeria.server.throttling.bucket4j.TokenBucketThrottlingStrategyBuilder<T>
@UnstableApi
public final class TokenBucketThrottlingStrategyBuilder<T extends com.linecorp.armeria.common.Request>
extends Object
Builds
TokenBucketThrottlingStrategy.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a newly-createdTokenBucketThrottlingStrategybased on the properties of this builder.headersScheme(ThrottlingHeaders headersScheme) OptionalThrottlingHeadersto define specific RateLimit Header Scheme for HTTP.headersScheme(ThrottlingHeaders headersScheme, boolean sendQuota) OptionalThrottlingHeadersto define specific RateLimit Header Scheme for HTTP.minimumBackoff(Duration minimumBackoff) OptionalDurationthat defines a minimum backoff period for throttled requests.Optional name of the strategy.
-
Method Details
-
name
Optional name of the strategy. By default, it will be assigned with a predefined name. -
minimumBackoff
OptionalDurationthat defines a minimum backoff period for throttled requests. By default, it will be set to 0 seconds. -
headersScheme
public TokenBucketThrottlingStrategyBuilder<T> headersScheme(ThrottlingHeaders headersScheme, boolean sendQuota) OptionalThrottlingHeadersto define specific RateLimit Header Scheme for HTTP. By default, no specialized throttling headers will be used. The strategy will only use standard HTTPRetry-Afterheader.- Parameters:
headersScheme- defines specific RateLimit Header Scheme for HTTP.sendQuota- indicates whether to use quota header for the scheme, likeX-RateLimit-Limit.
-
headersScheme
OptionalThrottlingHeadersto define specific RateLimit Header Scheme for HTTP. By default, no throttling headers will be used. The strategy will only use standard HTTPRetry-Afterheader.- Parameters:
headersScheme- defines specific RateLimit Header Scheme for HTTP. By default, the quota header will not be used for the scheme.
-
build
Returns a newly-createdTokenBucketThrottlingStrategybased on the properties of this builder.
-