|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
package cn.estsh.i3plus.pojo.base.bean;
|
|
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 基础fallback类,用于处理熔断
|
|
|
|
|
* @Reference :
|
|
|
|
@ -8,9 +11,27 @@ package cn.estsh.i3plus.pojo.base.bean;
|
|
|
|
|
* @Modify:
|
|
|
|
|
**/
|
|
|
|
|
public class BaseFallBackBean {
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(BaseFallBackBean.class);
|
|
|
|
|
|
|
|
|
|
// LOGGER.error("【微服出错,熔断】{}",cause.getMessage());
|
|
|
|
|
// LOGGER.error("【微服出错,熔断】{}",cause.getLocalizedMessage());
|
|
|
|
|
// LOGGER.error("【微服出错,熔断】{}",cause.getCause());
|
|
|
|
|
// cause.printStackTrace();
|
|
|
|
|
|
|
|
|
|
public BaseResultBean makeBaseFallBack(Throwable cause){
|
|
|
|
|
LOGGER.error("【熔断信息】{}",cause.getMessage());
|
|
|
|
|
LOGGER.error("【熔断原因】{}",cause.getCause());
|
|
|
|
|
return makeBaseFallBack("【微服熔断】服务暂停,请稍后再试。",cause);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResultBean makeBaseFallBack(String msg,Throwable cause){
|
|
|
|
|
LOGGER.error("【熔断信息】{}",cause.getMessage());
|
|
|
|
|
LOGGER.error("【熔断原因】{}",cause.getCause());
|
|
|
|
|
return BaseResultBean.buildBaseResultBean(false,cause.getMessage() + ",信息:" + msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResultBean makeBaseFallBack(){
|
|
|
|
|
return makeBaseFallBack("服务暂停");
|
|
|
|
|
return makeBaseFallBack("【微服熔断】服务暂停,请稍后再试。");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResultBean makeBaseFallBack(String msg){
|
|
|
|
|