You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing a project with Spring Cloud Gateway, where I am adding rate limit with Redis when creating the jar and running it, the rate limit configuration with Redis works correctly and it detects Redis.
When I create the native image with graalvm, that's where I have the issue that redis is not recognized.
./mvnw clean -Pnative native:compile -DskipTests
I tried adding reflect-config.json , but the problem still persists
I tried adding redis in code and in the yml file, but without success @configuration
public class RedisConfig { @bean @primary
ReactiveRedisConnectionFactory reactiveRedisConnectionFactory() {
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration("127.0.0.1", 6379);
redisStandaloneConfiguration.setPassword("oliver10");
return new LettuceConnectionFactory(redisStandaloneConfiguration);
}
I am developing a project with Spring Cloud Gateway, where I am adding rate limit with Redis when creating the jar and running it, the rate limit configuration with Redis works correctly and it detects Redis. org.springframework.boot spring-boot-starter-data-redis-reactive routes: - id: mock uri: https://jsonplaceholder.typicode.com predicates: - Path=/todos/1 filters: - name: RequestRateLimiter args: '[redis-rate-limiter.requestedTokens]': 1 '[redis-rate-limiter.replenishRate]': 1 '[redis-rate-limiter.burstCapacity]': 1 key-resolver: "#{@ipKeyResolver}" public class IpKeyResolver implements KeyResolver {
When I create the native image with graalvm, that's where I have the issue that redis is not recognized.
./mvnw clean -Pnative native:compile -DskipTests
I tried adding reflect-config.json , but the problem still persists I tried adding redis in code and in the yml file, but without success @configuration public class RedisConfig { @bean@primary ReactiveRedisConnectionFactory reactiveRedisConnectionFactory() { RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration("127.0.0.1", 6379); redisStandaloneConfiguration.setPassword("oliver10"); return new LettuceConnectionFactory(redisStandaloneConfiguration); }
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am developing a project with Spring Cloud Gateway, where I am adding rate limit with Redis when creating the jar and running it, the rate limit configuration with Redis works correctly and it detects Redis.
org.springframework.boot
spring-boot-starter-data-redis-reactive
routes:
- id: mock
uri: https://jsonplaceholder.typicode.com
predicates:
- Path=/todos/1
filters:
- name: RequestRateLimiter
args:
'[redis-rate-limiter.requestedTokens]': 1
'[redis-rate-limiter.replenishRate]': 1
'[redis-rate-limiter.burstCapacity]': 1
key-resolver: "#{@ipKeyResolver}"
public class IpKeyResolver implements KeyResolver {
}
java -jar target/gateway-0.0.1-SNAPSHOT.jar
I obtain status 429 from Many Request
When I create the native image with graalvm, that's where I have the issue that redis is not recognized.
./mvnw clean -Pnative native:compile -DskipTests
I tried adding reflect-config.json , but the problem still persists
I tried adding redis in code and in the yml file, but without success
@configuration
public class RedisConfig {
@bean
@primary
ReactiveRedisConnectionFactory reactiveRedisConnectionFactory() {
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration("127.0.0.1", 6379);
redisStandaloneConfiguration.setPassword("oliver10");
return new LettuceConnectionFactory(redisStandaloneConfiguration);
}
}
pring:
data:
redis:
host: localhost
port: 5672
password: 12345
ssl:
enabled: false
timeout: 5000
lettuce:
pool:
max-idle: 20
min-idle: 10
max-active: 100
max-wait: 1000
I share the example link
https://github.com/olivercruz/gateway_ratelimit_redis
Beta Was this translation helpful? Give feedback.
All reactions