开发者

Quartz how to schedule an online action as a scheduled job?

I developed a web application and one of the function is开发者_JS百科 to send emails.

I like to have the behaviour whereby the actual sending of emails is done in a batch job. Meaning when user click on the trigger button in online screen. The job for sending emails will be scheduled to run instead of immediately run.

How to do that exaclty? Any sample code references etc?


I would recommend Quartz website where I learnt Quartz.

For Spring integration, follow http://static.springsource.org/spring/docs/1.2.9/reference/scheduling.html


This tutorial will give you better idea how to schedule a job in quartz.

In example DumbJob.class will implement Job interface from Quartz and in turn provide execute() method. This method will contain batch job code.


I think what you really want to do is implement a queue / worker model here. The job gets added to a queue and periodically, workers poll the queue to determine if anything needs to be done.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜