Class Resque_Job

InheritanceResque_Job

Resque job.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined 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

Hide inherited methods

MethodDescriptionDefined 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

$payload public property

Object containing details of the job.

public object $payload null
$queue public property

The name of the queue that this job belongs to.

public string $queue null
$worker public property

Instance of the Resque worker running this job.

public Resque_Worker $worker null

Method Details

__construct() public method

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.

__toString() public method

Generate a string representation used to describe the current job.

public string __toString ( )
return string

The string representation of the job.

create() public static method

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.

fail() public method

Mark the current job as having failed.

public void fail ( $exception )
$exception
getArguments() public method

Get the arguments supplied to this job.

public array getArguments ( )
return array

Array of arguments.

getInstance() public method

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.

getStatus() public method

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.

perform() public method

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.

recreate() public method

Re-queue the current job.

public string recreate ( )
reserve() public static method

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.

updateStatus() public method

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.