Lock bucket for specific users #383
-
Hello, I'm completely new to bucket4j, I need to catch every request to the specific api, if the api is called more than 100 times in 1 hour, the API will be blocked for 2 hours for the specific user, after unlocking there will be some other limit not like the previous one, and so on, and I want to dynamically change this setting. Is there a way to implement this with Bucket4j. I looked at the documentation, it basically says how to save these buckets.Any help is appreciated |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hello,@vladimir-bukhtoyarov. |
Beta Was this translation helpful? Give feedback.
-
Out-of-the-box no. Bucket4j just implements token-bucket algorithm. It can provide only simple answer about available tokens. Implementation of thotling and penalty strategis is out of scope, you should implement it by yourself. Anyway dynamic reconfiguration is supported. Blocking of bucket for specified period of time is not supported, but you can aproximatelly emulate this behavior by force consumption.
No. I have no time to do so, try to start from there https://bucket4j.com/#third-party-articles and ask more concrete questions |
Beta Was this translation helpful? Give feedback.
Out-of-the-box no. Bucket4j just implements token-bucket algorithm. It can provide only simple answer about available tokens. Implementation of thotling and penalty strategis is out of scope, you should implement it by yourself. Anyway dynamic reconfiguration is supported. Blocking of bucket for specified period of time is not supported, but you can aproximatelly emulate this behavior by force consumption.
No. I have no time to do so, try to start from there https://bucket4j.com/#third-party-articles and ask more concrete questions