package com.yida.data.job.fallback;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.job.Job;
import com.yida.data.job.feign.RemoteJobService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * RemoteJobService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteJobServiceFallback implements FallbackFactory<RemoteJobService> {

    @Override
    public RemoteJobService create(Throwable throwable) {
        log.error("RemoteJobService fallback reason:{}", throwable.getMessage());

        return new RemoteJobService() {
            @Override
            public ResultBean saveJob(Job job) {
                return null;
            }

            @Override
            public ResultBean saveJobNoPermission(Job job) {
                return null;
            }

            @Override
            public ResultBean delJobByMethod(String beanName, String methodName, String params) {
                return null;
            }
        };
    }
}
