package com.sptg.iot.api.feigns.fallback;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.iot.api.dto.IotAlarmThresholdDto;
import com.sptg.iot.api.feigns.IotAlarmThresholdFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author zwx
 * @create 2020/10/19 23:31
 */
@Component
@Slf4j
public class IotAlarmThresholdFeignFallbackFactory implements FallbackFactory<IotAlarmThresholdFeign> {
    @Override
    public IotAlarmThresholdFeign create(Throwable cause) {
        return new IotAlarmThresholdFeign() {
            @Override
            public ResultBean<String> syncIotAlarmThresholdList(IotAlarmThresholdDto iotAlarmThresholdDto) {
                log.error(cause.getMessage(), cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }
        };
    }
}
