package com.bytesw.bytebot.etl.batch.service;

import com.bytesw.bytebot.etl.batch.beans.DBConfig;
import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class SchedulerConfiguration {
    @Bean
    public LockProvider lockProvider(DataSource dataSource) {
        DBConfig dbConfig = new DBConfig();
        dataSource = dbConfig.dataSource();
        return new JdbcTemplateLockProvider(dataSource);
    }
}