修改FeignClient接口名称和服务降级处理类名称及路径
This commit is contained in:
@@ -2,7 +2,7 @@ package com.njcn.algorithm.pojo.liteflow;
|
||||
|
||||
|
||||
import com.njcn.algorithm.pojo.bo.BaseParam;
|
||||
import com.njcn.algorithm.pojo.liteflow.fallback.LiteFlowFeignClientFallbackFactory;
|
||||
import com.njcn.algorithm.pojo.liteflow.fallback.LiteFlowAlgorithmFeignClientFallbackFactory;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
@@ -13,11 +13,11 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
* @author xuyang
|
||||
*/
|
||||
@FeignClient(
|
||||
value = ServerInfo.DATA_PLATFORM,//对应模块名
|
||||
path = "/executor",//对应controller请求类
|
||||
fallbackFactory = LiteFlowFeignClientFallbackFactory.class//服务降级处理类
|
||||
value = ServerInfo.ALGORITHM_BOOT,//对应模块名
|
||||
path = "/algorithmExecutor",//对应controller请求类
|
||||
fallbackFactory = LiteFlowAlgorithmFeignClientFallbackFactory.class//服务降级处理类
|
||||
)
|
||||
public interface LiteFlowFeignClient {
|
||||
public interface LiteFlowAlgorithmFeignClient {
|
||||
|
||||
@ApiOperation("监测点算法执行链")
|
||||
@PostMapping("/measurementPointExecutor")
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.njcn.algorithm.pojo.liteflow.fallback;
|
||||
|
||||
import com.njcn.algorithm.pojo.bo.BaseParam;
|
||||
import com.njcn.algorithm.pojo.liteflow.LiteFlowFeignClient;
|
||||
import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
|
||||
import com.njcn.algorithm.pojo.util.PrepareEnumUtil;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -11,9 +11,9 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class LiteFlowFeignClientFallbackFactory implements FallbackFactory<LiteFlowFeignClient> {
|
||||
public class LiteFlowAlgorithmFeignClientFallbackFactory implements FallbackFactory<LiteFlowAlgorithmFeignClient> {
|
||||
@Override
|
||||
public LiteFlowFeignClient create(Throwable throwable) {
|
||||
public LiteFlowAlgorithmFeignClient create(Throwable throwable) {
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException)throwable.getCause();
|
||||
@@ -21,7 +21,7 @@ public class LiteFlowFeignClientFallbackFactory implements FallbackFactory<LiteF
|
||||
}
|
||||
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new LiteFlowFeignClient() {
|
||||
return new LiteFlowAlgorithmFeignClient() {
|
||||
@Override
|
||||
public void measurementPointExecutor(BaseParam baseParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "监测点算法执行链: ", throwable.toString());
|
||||
@@ -50,7 +50,7 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
@Api(tags = "算法执行中心")
|
||||
@RestController
|
||||
@RequestMapping("/executor")
|
||||
@RequestMapping("/algorithmExecutor")
|
||||
@RequiredArgsConstructor
|
||||
public class ExecutionCenter extends BaseController {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user