1.10.1.2.1. Defining a job

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

Here is DumbJob.java:

package com.acme.samples;


import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.mail.MailService;
import org.exoplatform.services.mail.Message;
import org.exoplatform.commons.utils.CommonsUtils;
public class DumbJob implements Job {
    
    private static final Log log = ExoLogger.getLogger(DumbJob.class);
    
    public void execute(JobExecutionContext context) throws JobExecutionException {
        log.info("DumbJob is running!!!");
    }
}

All jobs are required to implement the method execute of org.quartz.Job interface. This method will be called when a job is triggered. With DumbJob, you just use logging to see that it will work.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus