Candlepin will need the ability to schedule long running jobs to sync subscription and product data. The engine itself is generic enough to use for any scheduled job.
Adding a new task to Pinsetter is quite simple, so simple it can be done in 3 easy steps.
Job
interfacetasks
configuration entry in /etc/candlepin/candlepin.conf
public static String DEFAULT_SCHEDULE
or add a schedule entry to the same configThat’s it. Pinsetter will now execute that job on the defined schedule.
Here is a very simple job that prints when it was run.
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.util.Date;
/**
* SimpleTask
*/
public class SimpleTask extends KingpinJob {
/** must be in CRON format */
public static final String DEFAULT_SCHEDULE = "0 * * * * ?";
@Override
public void toExecute(final JobExecutionContext ctx)
throws JobExecutionException {
System.out.println("simple task ran: " + new Date().toString());
}
}