@FeignClient可以作为Http代理访问其他微服务节点,可以用apache的httpclient替换@FeignClient原生的URLConnection请求方式,以达到让http请求走Http线程池的目的。而@FeignClient和hystrix集成之后,在hystrix dashboard上可以监控到
@FeignClient
中接口调用情况和@FeignClient
中httpclient中线程池使用状况。
下面是demo的示例:
1、@FeignClient的接口代码如下:
@FeignClient(value="service-A", fallback=ServiceClientHystrix.class)
public interface ServiceClient {
@RequestMapping(method = RequestMethod.GET, value = "/add/{id}")
String add(@PathVariable("id") Integer id);
}
2、
ServiceClientHystrix<