omsfeign熔断;
This commit is contained in:
@@ -4,13 +4,14 @@ import com.mhd.common.core.constant.ServiceNameConstants;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.system.api.domain.*;
|
||||
import com.mhd.system.api.factory.RemoteBmsFeignFallbackFactory;
|
||||
import com.mhd.system.api.factory.RemoteOmsFeignFallbackFactory;
|
||||
import com.mhd.system.api.feign.FeignAutoConfiguration;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE, fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE, fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface OmsServiceFeign {
|
||||
|
||||
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.mhd.system.api.factory;
|
||||
|
||||
import com.mhd.common.core.domain.dto.BusinessDataPushDTO;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.system.api.BmsServiceFeign;
|
||||
import com.mhd.system.api.OmsServiceFeign;
|
||||
import com.mhd.system.api.domain.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author zg
|
||||
* @Version 1.0
|
||||
* @Date 2023/11/3 14:37
|
||||
*/
|
||||
@Component
|
||||
public class RemoteOmsFeignFallbackFactory implements FallbackFactory<OmsServiceFeign> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteOmsFeignFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public OmsServiceFeign create(Throwable throwable) {
|
||||
log.error("系统服务调用失败:{}", throwable.getMessage());
|
||||
return new OmsServiceFeign() {
|
||||
|
||||
@Override
|
||||
public AjaxResult pushInOrder(StockInOrderTZPD stockInOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult pushInOrderDetail(InMaterialDetailTZPD inMaterialDetail) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult pushOutOrder(StockOutOrderTZPD stockOutOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult pushOutOrderDetail(OutMaterialDetailTZPD outMaterialDetail) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult omsEdit(MaterialInventoryOmsParamDO materialInventoryOmsParamDO) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user