About the new RateLimiting annotation #265
-
Hi everybody. I'm pretty interested in the new RateLimiting annotation (#250). Seems perfect in my current project, where I with to limit few specific methods with a separated bucket logic from the rest. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey, the RateLimiting annotation is independent from the filter configuration. Annotation: There is still a bug as it is only works in a web application: Can you enable debug in your property and search for the Bucket4jAopConfig class. Is it enabled?
|
Beta Was this translation helpful? Give feedback.
-
Yes. It's actually enabled.
Its parsing the configured expressions too, but no rate limit is applied to response of the controller.
I disabled the filters configuration while testing to prevent any conflict too. Edit: After some more testing, I discover which the rate is actually been limited. Just not showing "X-Rate-Limit-Retry-After-Seconds" header in the response. Instead, it launches a RateLimitException which can be conveniently handled. |
Beta Was this translation helpful? Give feedback.
Yes, the headers are only added when the filters are used.
Exception Handler in Caffeine Example