正在显示
3 个修改的文件
包含
22 行增加
和
12 行删除
| 1 | +package com.sy.feign; | ||
| 2 | + | ||
| 3 | +import feign.Retryer; | ||
| 4 | +import org.springframework.context.annotation.Bean; | ||
| 5 | +import org.springframework.context.annotation.Configuration; | ||
| 6 | + | ||
| 7 | +@Configuration | ||
| 8 | +public class BaseInterceptor { | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * 设置feign重试次数 | ||
| 12 | + * @return | ||
| 13 | + */ | ||
| 14 | + @Bean | ||
| 15 | + public Retryer feignRetryer() { | ||
| 16 | + // 设置最大重试次数为3次 | ||
| 17 | + return new Retryer.Default(1000, 5000, 3); | ||
| 18 | + } | ||
| 19 | +} |
| @@ -13,17 +13,6 @@ import javax.servlet.http.HttpServletRequest; | @@ -13,17 +13,6 @@ import javax.servlet.http.HttpServletRequest; | ||
| 13 | @Configuration | 13 | @Configuration |
| 14 | public class NmmsInterceptor { | 14 | public class NmmsInterceptor { |
| 15 | 15 | ||
| 16 | - | ||
| 17 | - /** | ||
| 18 | - * 设置feign重试次数 | ||
| 19 | - * @return | ||
| 20 | - */ | ||
| 21 | - @Bean | ||
| 22 | - public Retryer feignRetryer() { | ||
| 23 | - // 设置最大重试次数为3次 | ||
| 24 | - return new Retryer.Default(1000, 5000, 3); | ||
| 25 | - } | ||
| 26 | - | ||
| 27 | @Bean | 16 | @Bean |
| 28 | public RequestInterceptor requestInterceptor() { | 17 | public RequestInterceptor requestInterceptor() { |
| 29 | return new RequestInterceptor() { | 18 | return new RequestInterceptor() { |
| 1 | package com.sy.service.feigin; | 1 | package com.sy.service.feigin; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.sy.feign.BaseInterceptor; | ||
| 5 | +import com.sy.feign.NmmsInterceptor; | ||
| 4 | import com.sy.model.LockFeignResponse; | 6 | import com.sy.model.LockFeignResponse; |
| 5 | import com.sy.model.NoticeLock; | 7 | import com.sy.model.NoticeLock; |
| 6 | import com.sy.response.ResultJson; | 8 | import com.sy.response.ResultJson; |
| @@ -13,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam; | @@ -13,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam; | ||
| 13 | * 金二报文发送接口 | 15 | * 金二报文发送接口 |
| 14 | * @author mrz | 16 | * @author mrz |
| 15 | */ | 17 | */ |
| 16 | -@FeignClient(name = "SEND-IBMMQ-SERVIER",fallbackFactory = G2X81FeignFallBackFactory.class) | 18 | +@FeignClient(name = "SEND-IBMMQ-SERVIER",fallbackFactory = G2X81FeignFallBackFactory.class,configuration = BaseInterceptor.class) |
| 17 | public interface G2X81FeignService { | 19 | public interface G2X81FeignService { |
| 18 | 20 | ||
| 19 | @PostMapping("/ibm/mq/sendMsg") | 21 | @PostMapping("/ibm/mq/sendMsg") |
-
请 注册 或 登录 后发表评论