package com.eactive.eai.rms.onl.server.backup;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
import com.eactive.eai.rms.onl.server.repository.TransactionRepositoryService;

public class TransactionRepositoryBackupJob10Min implements Runnable {

    @Autowired
    @Qualifier("transactionRepositoryService")
    private TransactionRepositoryService transactionRepositoryService;

    public void run() {
        // transactionRepositoryService 에서 Datasource 못찾는 문제 때문에 강제 지정
        DataSourceContextHolder.setDataSourceType(DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING));
        transactionRepositoryService.backupRepository();
    }

}
