It's still a WIP but I created a TapestryJobCreator which gets a PerthreadManager and a Runnable (your service) in the JobDataMap. This just calls run() on the service and does any cleanup. I need to tidy up the job creation part but you could easily get to the point where you had something like:
public static void contributeSchedulerService(Configuration<JobInfo> config, MyService service) { config.add(new JobInfo("0 0/30 * * * ?", service)); } (where MyService implements Runnable and JobInfo is just a simple DTO) Here is the TapestryJobCreator... public class TapestryJobCreator implements Job { private static final Logger logger=LoggerFactory.getLogger(TapestryJobCreator.class); public void execute(JobExecutionContext context) throws JobExecutionException { logger.info("Executing job"); PerthreadManager perthreadManager = (PerthreadManager) context .getJobDetail().getJobDataMap().get("perThreadManager"); Runnable runner = (Runnable) context .getJobDetail().getJobDataMap().get("runner"); try { runner.run(); } finally { logger.info("Doing cleanup"); perthreadManager.cleanup(); } } } Hope it helps, Alfie. -----Original Message----- From: Daniel Henze [mailto:dhe...@googlemail.com] Sent: 12 July 2010 21:21 To: Tapestry users Subject: Quartz Job setup with JobDetails requires parameter free constructor - how to inject Service bindings Hi there, I am using chenillekit-quartz integration and followed the example setup on the module homepage (http://chenillekit.codehaus.org/chenillekit-quartz/index.html). All good so far, got things up and running. But now I want to run a job that has other services (DAO, MailService) as dependencies. Setup is done via JobDetails class which uses a parameter free constructor to instantiate the implementation of an Interface: new JobDetail("MailSenderJob", null, MailSenderJob.class) I tried binding that clas (MailSenderJob) with build method in Application module and @Inject annotation, but nothing did work, always getting a NullpointerException when it comes to that service. I also could not find a JobDetail constructor that allows for setting dependencies, but no luck. How can I get the service dependencies in MailSenderJob set up since Quartz does only use default constructor? Thankful for any hints Daniel --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org