domenica 11 dicembre 2011

JBoss and cron job

If your application needs to run a cron style job, Quartz Scheduler is best solution I found.

In JBoss (6.x) it is already in the environment and can be used within a Message driven bean.

My application generates a lot of "volatile" data that have to be removed from the database when it is old or it is already processed and re-aggregated.


@MessageDriven(activationConfig =
{@ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "0,30 * * ? * *")})
@ResourceAdapter("quartz-ra.rar")
public class CreanerJob implements Job {

    public void execute(JobExecutionContext arg0) {
          System.out.println("JOB");
    }

}

Nessun commento:

Posta un commento