【发布时间】:2020-01-02 12:36:23
【问题描述】:
我的服务前面有一个简单的 Spring Cloud Netflix Zuul。我想为到达这个 Zuul 的所有请求设置 速率限制。
我看过这个帖子:https://www.baeldung.com/spring-cloud-zuul-rate-limit 但是,我的 Zuul 或 JPA 存储库中都没有控制器。 Zuul 从 Eureka 接收的所有路由。
祖尔:
@SpringBootApplication
@EnableEurekaClient
@EnableZuulProxy
public class BlitzZuulApplication {
public static void main(String[] args) {
SpringApplication.run(BlitzZuulApplication.class, args);
}
}
application.properties:
spring.application.name=zuul
server.port = 7125
我的.eureka.port=7126eureka.client.service-url.defaultZone=http://localhost:${my.eureka.port}/eureka
pom.xml:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
<dependency>
<groupId>com.marcosbarbero.cloud</groupId>
<artifactId>spring-cloud-zuul-ratelimit-core</artifactId>
<version>2.2.4.RELEASE</version>
</dependency>
如何配置 Zuul 进行速率限制并限制总传入请求的数量?
【问题讨论】:
标签: java spring spring-boot netflix-zuul