Subversion Repositories SmartDukaan

Rev

Rev 23730 | Rev 23738 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23730 Rev 23731
Line 12... Line 12...
12
import org.springframework.scheduling.annotation.Scheduled;
12
import org.springframework.scheduling.annotation.Scheduled;
13
import org.springframework.stereotype.Component;
13
import org.springframework.stereotype.Component;
14
 
14
 
15
import com.spice.profitmandi.common.enumuration.SchemeType;
15
import com.spice.profitmandi.common.enumuration.SchemeType;
16
import com.spice.profitmandi.common.web.client.RestClient;
16
import com.spice.profitmandi.common.web.client.RestClient;
-
 
17
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
17
 
18
 
18
@Component
19
@Component
19
@ComponentScan("com.smartdukaan.cron.*")
20
@ComponentScan("com.smartdukaan.cron.*")
20
@ComponentScan("com.spice.profitmandi.common.*")
21
@ComponentScan("com.spice.profitmandi.common.*")
21
public class NagiosMonitorTasks {
22
public class NagiosMonitorTasks {
Line 24... Line 25...
24
 
25
 
25
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
26
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
26
 
27
 
27
	@Autowired
28
	@Autowired
28
	private RestClient restClient;
29
	private RestClient restClient;
-
 
30
	
-
 
31
	@Autowired
-
 
32
	ItemRepository itemRepository;
29
 
33
 
30
	@Scheduled(fixedRate = 5000)
34
	@Scheduled(fixedRate = 5000)
31
	public void reportCurrentTime() {
35
	public void reportCurrentTime() {
32
		log.info("The time is now {}", dateFormat.format(new Date()));
36
		log.info("The time is now {}", dateFormat.format(new Date()));
33
	}
37
	}
34
 
38
 
35
	@Scheduled(fixedRate = 5 * 60 * 1000)
39
	@Scheduled(fixedRate = 30 * 60 * 1000)
36
	public void reportSmsCount() throws Throwable {
40
	public void reportSmsCount() throws Throwable {
37
		String htmlpage;
41
		String htmlpage;
38
		int currentBalance = 0;
42
		int currentBalance = 0;
39
		String uri = "/MessagingGateway/LoginAction";
43
		String uri = "/MessagingGateway/LoginAction";
40
		Map<String, String> params = new HashMap<>();
44
		Map<String, String> params = new HashMap<>();
Line 51... Line 55...
51
			/// System.out.println(htmlpage);
55
			/// System.out.println(htmlpage);
52
			currentBalance = Integer.parseInt(htmlpage);
56
			currentBalance = Integer.parseInt(htmlpage);
53
			log.info("Got successfully parsed {}", currentBalance);
57
			log.info("Got successfully parsed {}", currentBalance);
54
		}
58
		}
55
	}
59
	}
-
 
60
 
-
 
61
	@Scheduled(fixedRate = 30 * 60 * 1000)
-
 
62
	public void dbCheck() throws Throwable {
-
 
63
		log.info("Connected to database successfully {}", itemRepository.isExistById(23));
-
 
64
	}
56
}
65
}
57
66