Interface SMS notification service degradation at fusing fallback, use redis notification once every 5 minutes, add the thread pool more efficiently
demo:
@FeignClient ( name = "order-server", fallback = ShopOrderDetailInterface.DefaultFallback.class ) public interface ShopOrderDetailInterface { @RequestMapping(value = {"/shop/order/detail"},method = {RequestMethod.POST}) @ResponseBody ShopOrderDetailResponseDTO processRequest(@RequestBody ShopOrderDetailRequestDTO requestDTO); @Component class DefaultFallback implements ShopOrderDetailInterface { @Override public ShopOrderDetailResponseDTO processRequest(ShopOrderDetailRequestDTO requestDTO) { // If the request parameter injection HttpRequest, where you can also get to the ip address, so when the service has blown, you can SMS notification, which took place fusing machine Value String = redisTemplate.get ( "order.fallback" ); IF (StringUtils.isBlank (value)) { // here to use the thread pool new new the Thread (() -> { System.out.println ( "... the order to send SMS notification service has been blown up ..." ); // here call texting interfaces TODO omitted redisTemplate.set ( "order.fallback", "Tag", 5 , TimeUnit.MINUTES); // for 5 minutes failed }) start ().; }else { System.out.println ( "Service was blown up ...." ); } return responseDTO; } } }