一、在需要限流的服务的pom.xml中增加限流相关依赖:
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-polaris-ratelimit</artifactId>
</dependency>
二、在polaris控制台配置限流规则:
在“服务列表”中找到对应的服务,点击进入服务详情页面,在“限流规则”选项卡中配置相应的限流规则
三、启动应用,并快速刷新限流服务中的某个接口,得到如下消息:
The request is denied by rate limit because the throttling threshold is reached