package com.its.pis.process;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class DbmsJobTask {

    @Async("dbmsJobExecutor")
    public void run(AbstractDbmsJobProcess dbmsJobProcess, DbmsJobData dbmsJobData) {

        dbmsJobProcess.runJob(dbmsJobData);
        /*log.info("DbmsJobTask.run: {}", Thread.currentThread().getName());

        while (true) {
            try {
                DbmsJobData dbmsJobData = AbstractDbmsJobProcess.DBMS_DATA_QUEUE.take();
                if (dbmsJobData != null) {
                    log.debug("DbmsJobTask.run: runJob, {}", Thread.currentThread().getName());
                    dbmsJobProcess.runJob(dbmsJobData);
                }
                else {
                    log.error("DbmsJobTask.run: Received data null");
                }
            } catch (Exception e) {
                log.error("DbmsJobTask.run: Exception: {}", e.getMessage(), e);
            }
        }*/
    }

}
