这是我的场景:
Eureka Server: MY-APP-SERVICE,在 localhost:8080、localhost:8081 和 localhost:8082 上运行 3 个相同的 Spring Boot 应用程序实例
OpenFeign 客户端(注解如下)
@FeignClient(name="MY-APP-SERVICE")
public interface MyFeignClient {...}
我有一个代理控制器,例如 MyAppServiceClientController 如下:
@RestController
public class MyAppServiceClientController {
Autowired
MyFeignClient myFeignClient;
@CircuitBreaker(name = "backendA")
public String doSomething() {
return myFeignClient.doSomething();
}
}
当 FeignClient 向 Eureka 注册中心询问服务 MY-APP-SERVICE 时,它会获得所有 3 个实例;似乎resilience4j在服务级别只有1个断路器,这里是MY-APP-SERVICE。
如何配置/注释我的 FeignClient 为我的 MY-APP-SERVICE 中的每个实例/URL 有一个单独的弹性 4j 断路器?