Any relation between Quartz API and Joda Time API?

别来无恙 提交于 2019-12-03 12:20:12

The AxonFramework has a QuartzEventScheduler which looks like it does what you want.

Here's the downlaod page and it's under the Apache 2.0 license.

Quartz provides a pretty comprehensive API that you could extend anyway you wanted.
The hook you would need to create would be against the Trigger interface, I've created one before but not using Joda time.

From the sounds of your question if you want to create a job that runs for a particular period of the day you could also just try using the CronTrigger. For example to run every minute between 9am and 11am you could do

* 9-10 * * *

Obviously Joda makes it much easier to configure but your sysadmins respect you more for cron...

I've started to use Joda Time in newer parts of my company's app and I've found it easier to link to the legacy parts (including Quartz scheduling) by converting the Joda Time object back to java.util.Date which the older parts are still expecting. I hope this helps.

TriggerBuilder has a snippet of how to schedule a job by hand:

JobDetail job = newJob(MyJob.class)
         .withIdentity("myJob")
         .build();

Trigger trigger = newTrigger() 
         .withIdentity(triggerKey("myTrigger", "myTriggerGroup"))
         .withSchedule(simpleSchedule()
             .withIntervalInHours(1)
             .repeatForever())
         .startAt(futureDate(10, MINUTES))
         .build();

scheduler.scheduleJob(job, trigger);

You will have to do some conversion work for the startAt() and the withIntervalInHours()...you get the drift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!