I want to design a scheduler as service using spring-boot. My scheduler should be generic so that other microservices can use it as they want.
I tried normal spring boot examples.
/** * This scheduler will run on every 20 Seconds. */ @Scheduled(fixedRate = 20 * 1000, initialDelay = 5000) public void scheduleTaskWithInitialDelay() { logger.info("Fixed Rate Task With Initail Delay 20 Seconds:: Execution Time - "+dateTimeFormatter.format(LocalDateTime.now())); }
/**
* This scheduler will run on every 10 Seconds.
*/
@Scheduled(fixedRate = 10* 1000, initialDelay = 5000)
public void scheduleTaskWithInitialDelay1() {
logger.info("Fixed Rate Task With Initail Delay 10 Seconds:: Execution Time - "+dateTimeFormatter.format(LocalDateTime.now()));
}