整体结构(一)
执行流程(二)
为什么有了ribbon之后还要出现feign呢?(三)
ribbon的调用方式:
@Autowired
RestTemplate restTemplate;
@HystrixCommand(fallbackMethod = "hiError")
public String hiService(String name) {
return restTemplate.getForObject("http://SERVICE-HI/hi?name="+name,String.class);
}
feign的调用方式(类似于微服务直接调用):
@FeignClient(value = "service-hi",fallback = SchedualServiceHystric.class)
public interface SchedualServiceHi {
@RequestMapping(value = "/hi",method = RequestMethod.GET)
String sayHiFromClientOne(@RequestParam(value = "name") String name
3. feign整合了hystrix的熔断机制。