package cn.datax.service.data.factory.api.feign.factory;

import cn.datax.service.data.factory.api.feign.DataSourceServiceFeign;
import cn.datax.service.data.factory.api.feign.fallback.DataSourceServiceFeignFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class DataSourceServiceFeignFallbackFactory implements FallbackFactory<DataSourceServiceFeign> {

    @Override
    public DataSourceServiceFeign create(Throwable throwable) {
        DataSourceServiceFeignFallbackImpl dataSourceServiceFeignFallback = new DataSourceServiceFeignFallbackImpl();
        dataSourceServiceFeignFallback.setCause(throwable);
        return dataSourceServiceFeignFallback;
    }
}
