| Developing Quartz MDB |
|
|
|
| Written by Mark S. | |||||
| Wednesday, 29 April 2009 14:18 | |||||
|
The following quick tutorial explains how you can have your Quartz Jobs served by an MDB gateway. JBoss ships with a bundled release of Quartz scheduler. If you need to be introduced to Quartz scheduler I suggest you to read at first the following tutorial:
package com.sample;
import javax.ejb.MessageDriven;
import org.jboss.ejb3.annotation.ResourceAdapter;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import javax.ejb.ActivationConfigProperty;
@MessageDriven(activationConfig =
{@ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "0 0-5 16 * * ?")})
@ResourceAdapter("quartz-ra.rar")
public class QuartzMDB implements Job
{
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException
{
System.out.println("Quartz job executed!");
}
}
As you can see, it's a simple MDB which implements the Quartz's Job interface. The cronTrigger activation spec attribute is required and its value specifies that a new Job is fired at 4.00 PM every minute until 4.05 PM.
JBoss.org Search
Custom Search
Only registered users can write comments!
Powered by !JoomlaComment 3.26
3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved." |
|||||
| Last Updated ( Wednesday, 29 April 2009 15:16 ) |





