Class Resque_Job
Inheritance | Resque_Job |
---|
Resque job.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$payload | object | Object containing details of the job. | Resque_Job |
$queue | string | The name of the queue that this job belongs to. | Resque_Job |
$worker | Resque_Worker | Instance of the Resque worker running this job. | Resque_Job |
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Instantiate a new instance of a job. | Resque_Job |
__toString() | Generate a string representation used to describe the current job. | Resque_Job |
create() | Create a new job and save it to the specified queue. | Resque_Job |
fail() | Mark the current job as having failed. | Resque_Job |
getArguments() | Get the arguments supplied to this job. | Resque_Job |
getInstance() | Get the instantiated object for this job that will be performing work. | Resque_Job |
getStatus() | Return the status of the current job. | Resque_Job |
perform() | Actually execute a job by calling the perform method on the class associated with the job with the supplied arguments. | Resque_Job |
recreate() | Re-queue the current job. | Resque_Job |
reserve() | Find the next available job from the specified queue and return an instance of Resque_Job for it. | Resque_Job |
updateStatus() | Update the status of the current job. | Resque_Job |
Property Details
Object containing details of the job.
The name of the queue that this job belongs to.
Instance of the Resque worker running this job.
Method Details
Instantiate a new instance of a job.
public void __construct ( $queue, $payload ) | ||
$queue | string | The queue that the job belongs to. |
$payload | array | Array containing details of the job. |
Generate a string representation used to describe the current job.
public string __toString ( ) | ||
return | string | The string representation of the job. |
---|
Create a new job and save it to the specified queue.
public static string create ( $queue, $class, $args = null, $monitor = false ) | ||
$queue | string | The name of the queue to place the job in. |
$class | string | The name of the class that contains the code to execute the job. |
$args | array | Any optional arguments that should be passed when the job is executed. |
$monitor | boolean | Set to true to be able to monitor the status of a job. |
Mark the current job as having failed.
public void fail ( $exception ) | ||
$exception |
Get the arguments supplied to this job.
public array getArguments ( ) | ||
return | array | Array of arguments. |
---|
Get the instantiated object for this job that will be performing work.
public object getInstance ( ) | ||
return | object | Instance of the object that this job belongs to. |
---|
Return the status of the current job.
public int getStatus ( ) | ||
return | int | The status of the job as one of the Resque_Job_Status constants. |
---|
Actually execute a job by calling the perform method on the class associated with the job with the supplied arguments.
public bool perform ( ) | ||
throws | Resque_Exception | When the job's class could not be found or it does not contain a perform method. |
---|
Re-queue the current job.
public string recreate ( ) |
Find the next available job from the specified queue and return an instance of Resque_Job for it.
public static null|object reserve ( $queue ) | ||
$queue | string | The name of the queue to check for a job in. |
return | null|object | Null when there aren't any waiting jobs, instance of Resque_Job when a job was found. |
---|
Update the status of the current job.
public void updateStatus ( $status ) | ||
$status | int | Status constant from Resque_Job_Status indicating the current status of a job. |