Child pages
  • How can we schedule Quartz jobs

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3


  • Integrating Quartz with the framework requires some glue code.

Coding a Quartz ActionJob

Code Block
package com.trantek.sit.action;

import com.opensymphony.xwork.ActionProxy;
import com.opensymphony.xwork.ActionProxyFactory;
import com.opensymphony.xwork.interceptor.component.ComponentInterceptor;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.util.HashMap;

public class ActionJob implements Job
    public void execute(JobExecutionContext context) throws JobExecutionException
            HashMap ctx = new HashMap();
            ctx.put(ActionContext.PARAMETERS, context.getJobDetail().getJobDataMap());
            ctx.put(ComponentInterceptor.COMPONENT_MANAGER, ???);
            ctx.put(???, ???)
            ActionProxy proxy = ActionProxyFactory.getFactory().
                    createActionProxy("", context.getJobDetail().getName(), ctx);

        catch (Exception e)
            throw new JobExecutionException(e);


  • The name of your job is the name of the Action to execute (no ".action" equivalent suffix).
  • All the parameters being sent to the Action are provided by the JobDataMap of the JobDetail object.

    According to the Javadocs of, the Quartz scheduler is setup as a servlet.

Sample Quartz Email Action

The following code schedules an e-mail action: