2
liusuyi
2026-05-12 9b5c9db9189493fbc6db48f55a7b7311b2a3253c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.ard.vtdu.api.factory;
 
import com.ard.common.core.domain.R;
import com.ard.vtdu.api.RemoteArdMediaService;
import com.ard.vtdu.api.RemoteArdVtduService;
import com.ard.vtdu.api.domian.ArdVtdu;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
/**
 * 流媒体服务降级处理
 * 
 * @author ard
 */
@Component
public class RemoteArdMediaFallbackFactory implements FallbackFactory<RemoteArdMediaService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteArdMediaFallbackFactory.class);
 
    @Override
    public RemoteArdMediaService create(Throwable throwable)
    {
        log.error("流媒体Mediamtx服务调用失败:{}", throwable.getMessage());
        return new RemoteArdMediaService() {
 
 
            @Override
            public R<ArdVtdu> add(ArdVtdu ardVtdu, String source) {
                return R.fail("添加Mediamtx失败:" + throwable.getMessage());
            }
 
            @Override
            public R<String> remove(String name, String source) {
                return R.fail("移除Mediamtx失败:" + throwable.getMessage());
            }
        };
    }
}