1. Summary of issues,
If the project uses ThreadLocal, attention hystix create a new thread, ThreadLocal data is stored in the thread before, get less in hystix thread
2, issue
throwable abnormal parameters must be written in the last side
public String getText(long liveId,int sdkId,Throwable throwable) { if (throwable instanceof HystrixTimeoutException) { logger.error("m={} is fusing;request={};ex={}", "getLiveVideoDependInfofallBack", JSON.toJSONString(request), "timeout"); }else { logger.warn("m={} is fusing;request={}", "getLiveVideoDependInfofallBack", JSON.toJSONString(request)); } return liveVideoInfoResponse; }
3, springboot start classes add EnableHystrix open Hystrix
@SpringBootApplication @ImportResource("classpath:spring-*.xml") @EnableHystrix public class App { public static void main(String[] args) { SpringApplication.run(App.class, args); } }
4, when the asynchronous mode notes, careful to cover the get method
@Override public GetLiveVideoInfoResponse get() { return invoke(); }