package com.yida.data.device.fallback;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.device.feign.telephone.RemoteTelephoneService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * RemoteTelephoneService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteTelephoneServiceFallback implements FallbackFactory<RemoteTelephoneService> {

    @Override
    public RemoteTelephoneService create(Throwable throwable) {
        log.error("RemoteTelephoneService fallback reason:{}", throwable.getMessage());

        return new RemoteTelephoneService() {
            /**
             * 更新设备在线状态
             */
            @Override
            public ResultBean updateTelephoneStatus() {
                return null;
            }
        };
    }
}
