I am working on a new application, which will require some scheduled jobs. I used EJB3 Timers in 10MinuteMail, but now Seam includes and uses Quartz, an open source scheduling system. So I figured I'd try the new hotness.
So far, it's been a rough road, and I'm not 100% up and running yet (hence the part 1 in the title), but I wanted to share what I've learned along the way as the Seam documentation is lacking a lot of information (although some of what's below mirrors the Seam documentation).
First you have to enable the Quartz engine for handling @Asynchronous methods. Add this line to your components.xml file:
<async:quartz-dispatcher />
I also found that I had to define the async namespace in my component.xml (generated by seam-gen from Seam 2.0 CR1):
xmlns:async="http://jboss.com/products/seam/async"
Then I set up my method:
@Asynchronous
public QuartzTriggerHandle scheduleSiteCheck(@Expiration
Date pWhen, @IntervalDuration
Long pInterval, Long pSiteId) {
Site site = (Site) entityManager.createQuery("from Site where id = :id").setParameter("id", pSiteId)
.getSingleResult();
checkSite(site);
return null;
}
(more...)