On spring scheduler, this is what I wanted to achieved:
@Scheduled(initialDelay = 1000, fixedDelay = 5000)
I'm moving to quartz, and I cannot seem to find the equivalent API for the initial delay.
TriggerBuilder.newTrigger().withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInMilliseconds(5000));
Any ideas how I can add the delay?
Use TriggerBuilder::startAt
Trigger trigger = newTrigger()
.withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInMilliseconds(5000))
.startAt(nowPlusDelay(5_000))
.build();
Where nowPlusDelay(int) returns a Date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With