package com.zd.bottle.feign;

import com.zd.bottle.feign.service.RemoteBottleService;
import com.zd.common.core.domain.R;
import com.zd.system.api.airbottle.RemoteAirBottleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author Administrator
 */
@Component
public class RemoteBottleFallbackFactory implements FallbackFactory<RemoteBottleService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteBottleFallbackFactory.class);

    @Override
    public RemoteBottleService create(Throwable throwable) {
        log.error("气瓶服务调用失败:{}", throwable.getMessage());
        return tag -> R.fail("新增报警记录失败:" + throwable.getMessage());
    }
}
