Questions tagged [bucket4j]
12 questions
2
votes
1 answer
Having multiple request IPs in Spring WebTestClient
I'm introducing Bucket4J in my Spring Web application. A basic test setup can be found…

nykon
- 504
- 4
- 18
1
vote
1 answer
Bucket4J enable or disable dynamically
I know than a rate limiter with Bucket4J can be reconfigured dynamically, but can it be dinamically enabled/disabled ?
In my case, if the configurations is 0 permits (per seconds), it means it's disabled. And internally I configure the bucket with…

Oscar Besga Panel
- 25
- 7
1
vote
1 answer
Bucket4j not running, to rate limit api
Pom.xml file
com.giffing.bucket4j.spring.boot.starter
bucket4j-spring-boot-starter
0.7.0
…

Ali Azlan
- 77
- 1
- 9
1
vote
1 answer
Java Spring rate limiter block specific duration when ratio reached
Currently I have a requirement: Apply rate limiter for an API. If this API get called over 100 times per 5 sec then the API will be blocked for 10 mins.
I don't know if there is any java lib can fullfill this requirement. If the requirement is…

SoT
- 898
- 1
- 15
- 36
1
vote
1 answer
Using Rate Limiting doesn't add Header to response and gets CORS error in client
I'm trying to adapt this tutorial to my server using the Bucket4j Spring Boot Starter.
I'm using an application.properties file.
I can limit the api queries with no problem, but the client doesn't get a 429 error, on the client I get a CORS error.
I…

Pabort
- 348
- 1
- 11
0
votes
0 answers
How can we use bucket4j spring boot starter with spring cloud gateway?
I've to rate limit users based on their plans and endpoints. Unfortuntely, there is no built in solutions in spring cloud gateway with lettuce redis client. I came across bucket4j-spring boot starter. But I couldn't find examples about it. I need to…
0
votes
1 answer
Bucket4j api does not provide last comsumtion time
I am using bucket4j to do some rate limiting in my project.
I have 1M users
Basically I have for each user 1 bucket
I keep the buckets in a ConcurrentHashMap structure
Not all users are connected at the same time and I need to remove…

Deibys
- 619
- 3
- 9
- 18
0
votes
0 answers
Springboot, Caffeine and bucket4j Integration with individual expiry for each cache
I have created a Springboot app and have implemented in-memory Cache & throttling using Caffeine and bucket4j.
application.yml
spring:
cache:
jcache:
provider: com.github.benmanes.caffeine.jcache.spi.CaffeineCachingProvider
…

Andy
- 5,433
- 6
- 31
- 38
0
votes
1 answer
How to use Bucket4j with postgresql
A use case arose in which I needed to rate-limit requests for specific endpoints per user in a spring boot application that does not have an API gateway and has no plans to add one,the use case is as follows:
(1) I have a user name obtained through…

SpaceSloth
- 85
- 7
0
votes
2 answers
Unit test proxyManager
I need to unit test this code, but i have been seeing null pointer exceptions at buckets.builder().
import io.github.bucket4j.distributed.proxy.ProxyManager;
private ProxyManager buckets;
public Bucket resolveBucket(String key) {
…

Aishwarya Patil
- 49
- 1
- 6
0
votes
0 answers
Bucket4j rate limiting based on user with complicated condition
I have 2 requirements need to be fullfilled:
Apply rate limiting for an @GetMapping API based on user: only 15 requests per minute per user. Quite simple! I create a concurrent hashmap to group buckets by user. Any request comes,…

SoT
- 898
- 1
- 15
- 36
0
votes
1 answer
IP whitelisting in bucket4j
I am using bucket4j in my spring boot application to prevent DOS attacks where if an ip makes a lots of requests in a minute, it is blocked. I am using following config for…

dev Joshi
- 305
- 2
- 21