使用
引入依赖
<!--hystrix依赖,主要是用 @HystrixCommand --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency>
# 开启熔断机制
feign: hystrix: enabled: true
# 设置hystrix的超时时间,默认是1000毫秒
hystrix: metrics: polling-interval-ms: 6000 @FeignClient(name = "service-vod",fallback = VodFileDegradeFeignClient.class) @Component public interface VodClient { /** * videoId是指云端视频id,对应video数据库中的video_source_id * @param videoId * @return */ @DeleteMapping(value = "/eduvod/video/removeAlyVideo/{videoId}") public R removeVideo(@PathVariable("videoId") String videoId); }
###