package com.tofly.base.api.feign.factory;

import com.tofly.base.api.feign.FlowableService;
import com.tofly.base.api.feign.fallback.BaseUserServiceFallbackImpl;
import com.tofly.base.api.feign.fallback.FlowableServiceFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author tuonbed
 * @date 2019/12/3  16:55
 */
@Component
public class FlowableServiceFallbackFactory implements FallbackFactory<FlowableService> {

    @Override
    public FlowableService create(Throwable throwable) {
        FlowableService flowableService=new FlowableServiceFallbackImpl();
        ((BaseUserServiceFallbackImpl) flowableService).setThrowable(throwable);
        return flowableService;
    }
}
