Closed www-viveksharma closed 1 year ago
I was looking on my redis server where I am testing this and I see:
redis-cli -h <my.ip.addr>
<my.ip.addr>:6379> KEYS *
1) "my-bucket4j-cache-redis"
<my.ip.addr>:6379> hgetall my-bucket4j-cache-redis
1) "\"Tenant:1038849272730853\""
2) "\"AAAAAQAAAAEAAAABAAAAAQAAAAAAAAfQAAAAAAAAB9AAAAAN+EdYAAAAAAAAAAfQAYAAAAAAAAAAAAAAAAADAAAAAQAAAAMXhMkS0JJrAAAAAAAAAAfQAAAAAAAAAAAAAAABAAAAAAAAAAA=\""
and when I am debugging I am seeing the following:
so looks like on redis the bytes written as string are not being deserialized properly when read back at JCacheProxyManager
#1 noted from https://github.com/MarcGiffing/bucket4j-spring-boot-starter that I should have used version 0.8.1 of bucket4j-spring-boot-starter :
<dependency>
<groupId>com.giffing.bucket4j.spring.boot.starter</groupId>
<artifactId>bucket4j-spring-boot-starter</artifactId>
<!-- https://github.com/MarcGiffing/bucket4j-spring-boot-starter -->
<version>0.8.1</version> <!-- use 0.8.* gives you Bucket4j 8.1.0 & works with Spring Boot 2.7.x -->
<exclusions> <!-- EXCLUDE ehcache -->
<exclusion>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</exclusion>
</exclusions>
</dependency>
as 0.8.* gives you Bucket4j 8.1.0 & works with Spring Boot 2.7.x (which is the spring version I had)
#2 found that I had the following codec used in my redisson config yaml which was not correct for my use case:
codec: !<org.redisson.codec.JsonJacksonCodec> {}
removed this and now able to see at least the basic functionality working.
will proceed to testing the clustered redis deployment with bucket4j springboot starter 0.8.1 next.
Using bucket4j starter with spring boot version 2.7.15 and Java 17 (openJdk) along with redis (redisson-spring-boot-starter ver 3.23.2) getting an error when trying to do :
bucket.tryConsumeAsMuchAsPossible(num);
Error:
Caused by: