Class RateLimitingAspect
java.lang.Object
com.netcetera.girders.ratelimit.support.RateLimitingAspect
Aspect for applying a rate limit.
-
Constructor Summary
ConstructorDescriptionRateLimitingAspect
(RateLimitValuesRetriever rateLimitValuesRetriever, List<RateLimitKeyResolver> rateLimitKeyResolvers, io.micrometer.core.instrument.MeterRegistry meterRegistry, boolean enableMeterRegistry) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Apply a rate limit at the given join point.void
rateLimit
(org.aspectj.lang.JoinPoint joinPoint, RateLimits rateLimits) Apply a series of rate limits at the given join point.
-
Constructor Details
-
RateLimitingAspect
public RateLimitingAspect(RateLimitValuesRetriever rateLimitValuesRetriever, List<RateLimitKeyResolver> rateLimitKeyResolvers, io.micrometer.core.instrument.MeterRegistry meterRegistry, boolean enableMeterRegistry) Constructor.- Parameters:
rateLimitValuesRetriever
- Retriever for rate limit valuesrateLimitKeyResolvers
- Resolver for rate limit keysmeterRegistry
- Meter registry (optional)
-
-
Method Details
-
rateLimit
public void rateLimit(org.aspectj.lang.JoinPoint joinPoint, RateLimits rateLimits) throws RateLimitExceededException, ExecutionException Apply a series of rate limits at the given join point.- Parameters:
joinPoint
- the join pointrateLimits
- the rate limits to apply- Throws:
RateLimitExceededException
- in case the rate limit was exceededExecutionException
- if something else went wrong
-
rateLimit
public void rateLimit(org.aspectj.lang.JoinPoint joinPoint, RateLimit rateLimit) throws RateLimitExceededException, ExecutionException Apply a rate limit at the given join point.- Parameters:
joinPoint
- the join pointrateLimit
- the rate limit to apply- Throws:
RateLimitExceededException
- in case the rate limit was exceededExecutionException
- if something else went wrong
-