|
|
@@ -0,0 +1,35 @@
|
|
|
+package com.zd.algorithm.api.camera.feign.fallback;
|
|
|
+
|
|
|
+import com.zd.algorithm.api.camera.feign.RemoteCameraService;
|
|
|
+import com.zd.model.domain.R;
|
|
|
+import com.zd.model.enums.HardwareOperate;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.cloud.openfeign.FallbackFactory;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class RemoteCameraFallBackFactory implements FallbackFactory<RemoteCameraService> {
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(RemoteCameraFallBackFactory.class);
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RemoteCameraService create(Throwable throwable) {
|
|
|
+ log.error("摄像头在线离线调用失败:{}", throwable.getMessage());
|
|
|
+ return new RemoteCameraService() {
|
|
|
+ @Override
|
|
|
+ public R sends(String num, HardwareOperate hardwareOperate) {
|
|
|
+ return R.fail("摄像头在线离线调用失败:" + throwable.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R startRecord(String hostname) {
|
|
|
+ return R.fail("摄像头开始录像调用失败:" + throwable.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R stopRecord(String hostname) {
|
|
|
+ return R.fail("摄像头结束录像调用失败:" + throwable.getMessage());
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+}
|