package com.usky.meeting.factory;

import com.usky.common.core.exception.FeignBadRequestException;
import com.usky.meeting.RemoteMeetingService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;


/**
 * 用户服务降级处理
 *
 * @author ruoyi
 */
@Component
public class RemoteMeetingFallbackFactory implements FallbackFactory<RemoteMeetingService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteMeetingFallbackFactory.class);

    @Override
    public RemoteMeetingService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteMeetingService() {
            @Override
            public void meetingInfoStatus() {
                throw new FeignBadRequestException(500,"同步会议室预约状态异常"+throwable.getMessage());
            }
        };
    }
}
