spring-cloud/spring-cloud-gateway

Make RedisRateLimiter extensible?

Open

#393 aberto em 26 de jun. de 2018

Ver no GitHub
 (2 comments) (1 reaction) (0 assignees)Java (3.204 forks)batch import
enhancementhelp wanted

Métricas do repositório

Stars
 (4.284 stars)
Métricas de merge de PR
 (Mesclagem média 1d 21h) (18 fundiu PRs em 30d)

Description

Hey guys!

In order to be able to rate limit per user API key (versus basing the limit on the route) I had to extend RedisRateLimiter to make isAllowed(String routeId, String apiKey) calculate the limits based up on the route and the apiKey. Please see the full thing here: https://stackoverflow.com/questions/50988095/rate-limiting-based-on-user-plan-in-spring-cloud-gateway

As you see it is somewhat hackish there because there's no good way to extend RedisRateLimiter - see I had to decorate it, copy some private/default scoped methods over as well as hack the @Primary annotation so it gets into the bean factory well.

Do you think RedisRateLimiter would be re-architected to be easier to extend? Thanks!

Guia do colaborador