Subversion Repositories SmartDukaan

Rev

Rev 23759 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
23756 amit.gupta 1
package com.smartdukaan.cron.scheduled;
2
 
3
import org.apache.logging.log4j.LogManager;
4
import org.apache.logging.log4j.Logger;
5
import org.springframework.beans.factory.annotation.Autowired;
6
import org.springframework.scheduling.annotation.Scheduled;
7
import org.springframework.stereotype.Component;
8
 
9
import com.smartdukaan.cron.migrations.RunOnceTasks;
10
import com.smartdukaan.cron.monitored.NagiosMonitorTasks;
11
 
12
@Component
13
public class ScheduledSkeleton {
14
 
15
	private static final Logger log = LogManager.getLogger(ScheduledSkeleton.class);
16
 
17
	@Autowired
18
	ScheduledTasks scheduledTasks;
19
 
20
	@Autowired
21
	NagiosMonitorTasks nagiosMonitorTasks;
22
 
23
	@Autowired
24
	RunOnceTasks runOnceTasks;
25
 
26
	@Scheduled(cron = "1 00 * * * *")
27
	public void generateDailyRecharge() {
28
		scheduledTasks.generateDailyRecharge();
29
	}
30
 
31
	/*@Scheduled(cron = "0 45 0 * * *")
32
	public void processScheme() throws Exception {
33
		scheduledTasks.processScheme();
34
	}*/
35
 
36
	@Scheduled(cron = "0 45 * * * *")
37
	public void reconcileRecharge() throws Exception {
38
		scheduledTasks.reconcileRecharge();
39
	}
40
 
41
	@Scheduled(cron = "0 05 12 1,16 * ?")
42
	public void processRechargeCashback() throws Throwable {
43
		scheduledTasks.processRechargeCashback();
44
		nagiosMonitorTasks.reportSmsCount();
45
	}
46
 
47
	/*Value so big so that it got to run only once.
48
	 * 
49
	 */
50
	@Scheduled(fixedRate=Integer.MAX_VALUE)
51
	public void runOnce() throws Throwable
52
	{
53
		log.info("Started run Once");
54
		runOnceTasks.migarateLineItemsToNewTable();
55
	}
56
	@Scheduled(fixedRate=Integer.MAX_VALUE)
57
	public void runTwice() throws Throwable
58
	{
59
		log.info("Started run Twice");
60
		scheduledTasks.reconcileRecharge();
61
	}
62
	@Scheduled(fixedRate=Integer.MAX_VALUE)
63
	public void runThird() throws Throwable
64
	{
65
		log.info("Started run Third");
66
		scheduledTasks.generateDailyRecharge();
67
	}
68
 
69
}