Reputation: 6281
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?
Upvotes: 3
Views: 3283
Reputation:
Trigger trigger = newTrigger()
.withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInMilliseconds(5000))
.startAt(nowPlusDelay(5_000))
.build();
Where nowPlusDelay(int)
returns a Date
.
Upvotes: 6