|
@@ -0,0 +1,34 @@
|
|
|
+package com.usky.system.factory;
|
|
|
+
|
|
|
+
|
|
|
+import com.usky.common.core.bean.ApiResult;
|
|
|
+import com.usky.system.RemoteMceService;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.cloud.openfeign.FallbackFactory;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 消息服务降级处理
|
|
|
+ *
|
|
|
+ * @author ruoyi
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class RemoteMceFallbackFactory implements FallbackFactory<RemoteMceService>
|
|
|
+{
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(RemoteMceFallbackFactory.class);
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RemoteMceService create(Throwable throwable)
|
|
|
+ {
|
|
|
+ log.error("用户服务调用失败:{}", throwable.getMessage());
|
|
|
+ return new RemoteMceService()
|
|
|
+ {
|
|
|
+ @Override
|
|
|
+ public ApiResult<Void> addMce(String mceInfo)
|
|
|
+ {
|
|
|
+ return ApiResult.error("500","新增消息失败:" + throwable.getMessage());
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+}
|