package com.eactive.eai.common.scheduler;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;

import com.eactive.eai.common.dao.Keys;
import com.eactive.eai.common.util.JMSSender;
import com.eactive.eai.common.util.Logger;

public class TimerEventJob implements Job {
    static Logger logger = Logger.getLogger(Logger.LOGGER_SCHEDULER);
	
	public void execute(JobExecutionContext context) throws JobExecutionException {
        JobKey jobKey = context.getJobDetail().getKey();
        String msg = context.getJobDetail().getJobDataMap().getString("MSG");        
       
        try {
        	String instName = System.getProperty(Keys.SERVER_KEY);
			String timerQueue = instName.equals("bapSvr11") ? Keys.BAP01_TIMER_QUEUE : Keys.BAP02_TIMER_QUEUE;
            //sender.send(Keys.CONNECT_FACTORY, Keys.TIMER_QUEUE, msg, jobKey.getName());
        	JMSSender.sendToQueue(msg, Keys.CONNECT_FACTORY, timerQueue);
		} catch (Exception e) {
			logger.error( e.getMessage(), e);
		}
	}
	public void setDIR( String dir){
		return;
	}
	public void setMSG( String msg){
		return;
	}
	public void setTYPE( String type){
		return;
	}
}
