The JSMA job provides access to an individual background job.
The JSMA job provides the following methods:
Returns the job's database ID
... var id = job.id # => 1 ... |
Returns the job's status field
... var status = job.status; # => 'done' ... |
Returns the job's data object
... var data = job.data; # => { some: 'arguments', ... } ... |
Returns the job's log array in chronological order.
... var log = job.log; # => [{"type"=>"success", "message"=>"{\"status\": \"OK\"}", "time"=>"2018-09-21 13:48:17 +0200"}, ...] ... |
Resets the job status and tries. The job will be scheduled for retry. The log persists.
... job.retry() ... |
Cancels the job if it is scheduled to run.
... job.cancel() ... |
Updates the job's data object.
... job.update(JSON.stringify({ foo: 'bar' })); ... |
An arbitrary object serialized to JSON.
Sets the state of the job to 'error'. If there are tries left for this job it will be scheduled for retrying according to the 'wait' setting of the job profile.
... job.setError('some error occurred'); ... |
The error message that will be logged.
Sets the state of the job to 'fatal'. No further retries will be made.
... job.setFatal('some fatal error'); ... |
The error message that will be logged.
Sets the executionState
value of the job to 'fatal'. No further retries will be made.
... job.setExecutionState(1); ... |
The integer to be set as executionState
.