package com.usky.cdi.factory;

import com.usky.cdi.AlarmDataSyncTaskService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 *
 * @author fyc
 * @email yuchuan.fu@chinausky.com
 * @date 2025/12/29
 */
@Component
public class AlarmDataSyncTaskFactory implements FallbackFactory<AlarmDataSyncTaskService> {
    private static final Logger log = LoggerFactory.getLogger(AlarmDataSyncTaskFactory.class);

    @Override
    public AlarmDataSyncTaskService create(Throwable throwable) {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new AlarmDataSyncTaskService() {
            @Override
            public void synchronizeAlarmData(Integer tenantId, Long engineeringId, String username, String password, String status) {
                throw new RuntimeException(throwable);
            }
        };
    }
}
