リボンを介してマイクロ サービスの負荷を分散する方法 (偽りではありません)。「M1」、「M2」、「M2_duplication」の 3 つのマイクロ サービスがあり、「M1」は偽装を介して「M2」と通信しています。「M2」のトラフィックが多すぎる場合、リクエストは「M2_duplication」に転送されます。@ribbonclient を介してこれはどのように可能ですか?
POM M1:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-ribbon</artifactId>
</dependency>
M1 での偽の呼び出し:
//name is taken from Eureka(service registry)
@FeignClient(name = "M1")
public interface M1ServiceClient {
@RequestMapping(method = RequestMethod.GET, value = "/getAllM2")
Map<String, String> getAllM2();
}
アプリケーション M1:
@EnableConfigurationProperties()
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
public class PortefeuilleApplication {
public static void main(String[] args) {
SpringApplication.run(PortefeuilleApplication.class, args);
}
}