views:

36

answers:

3

I developed a web application and one of the function is 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?

A: 

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

Sujee
A: 

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.

Jaydeep
A: 

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.

Nick Gerakines