package com.eactive.eai.rms.onl.common.service;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import com.eactive.eai.rms.onl.common.service.ums.PrivacyUsageNoticeService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class PrivacyUsageNoticeJob  implements Job {
	
	private final PrivacyUsageNoticeService privacyUsageNoticeService;
	
	@Autowired
	public PrivacyUsageNoticeJob(PrivacyUsageNoticeService privacyUsageNoticeService) {
		this.privacyUsageNoticeService = privacyUsageNoticeService;
	}
	
	@Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        log.info("Starting Message Dispatch Job...");
        try {
        	privacyUsageNoticeService.processMessages();        	
        }catch (Exception e) {
            log.error("Failed to process messages", e);            
            throw new JobExecutionException(e);
        }
	}
}
