Symbiote\QueuedJobs\Services\QueuedJob
Interface definition for a queued job
- Author: Marcus Nyeholt <marcus@symbiote.com.au>
- License: BSD http://silverstripe.org/bsd-license/
Synopsis
interface QueuedJob
{
- // constants
- const IMMEDIATE = '1';
- const QUEUED = '2';
- const LARGE = '3';
- const STATUS_NEW = 'New';
- const STATUS_INIT = 'Initialising';
- const STATUS_RUN = 'Running';
- const STATUS_WAIT = 'Waiting';
- const STATUS_COMPLETE = 'Complete';
- const STATUS_PAUSED = 'Paused';
- const STATUS_CANCELLED = 'Cancelled';
- const STATUS_BROKEN = 'Broken';
- // methods
- public string getTitle()
- public string getSignature()
- public void setup()
- public void prepareForRestart()
- public void getJobType()
- public void process()
- public void jobFinished()
- public void getJobData()
- public void setJobData()
- public void addMessage()
Constants
Name | Value |
---|---|
IMMEDIATE | '1' |
QUEUED | '2' |
LARGE | '3' |
STATUS_NEW | 'New' |
STATUS_INIT | 'Initialising' |
STATUS_RUN | 'Running' |
STATUS_WAIT | 'Waiting' |
STATUS_COMPLETE | 'Complete' |
STATUS_PAUSED | 'Paused' |
STATUS_CANCELLED | 'Cancelled' |
STATUS_BROKEN | 'Broken' |
Methods
public
- addMessage() — Add an arbitrary text message into a job
- getJobData() — Return the current job state as an object containing data
- getJobType() — What type of job is this? Options are - QueuedJob::IMMEDIATE - QueuedJob::QUEUED - QueuedJob::LARGE
- getSignature() — Gets a unique signature for this job and its current parameters.
- getTitle() — Gets a title for the job that can be used in listings
- jobFinished() — Returns true or false to indicate that this job is finished
- prepareForRestart() — Called whenever a job is restarted for whatever reason.
- process() — A job is run within an external processing loop that will call this method while there are still steps left to complete in the job.
- setJobData() — Sets data about the job
- setup() — Setup this queued job. This is only called the first time this job is executed (ie when currentStep is 0)