PHP Класс Resque_Job, php-resque

Автор: Chris Boulton ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$payload Array containing details of the job.
$queue The name of the queue that this job belongs to.
$worker Instance of the Resque worker running this job.

Открытые методы

Метод Описание
__construct ( string $queue, array $payload ) Instantiate a new instance of a job.
__toString ( ) : string Generate a string representation used to describe the current job.
create ( string $queue, string $class, array $args = null, boolean $monitor = false, string $id = null ) : string Create a new job and save it to the specified queue.
fail ( $exception ) Mark the current job as having failed.
getArguments ( ) : array Get the arguments supplied to this job.
getInstance ( ) : Resque_JobInterface Get the instantiated object for this job that will be performing work.
getJobFactory ( ) : Resque_Job_FactoryInterface
getStatus ( ) : integer Return the status of the current job.
perform ( ) : boolean Actually execute a job by calling the perform method on the class associated with the job with the supplied arguments.
recreate ( ) : string Re-queue the current job.
reserve ( string $queue ) : false | object Find the next available job from the specified queue and return an instance of Resque_Job for it.
reserveBlocking ( array $queues, integer $timeout = null ) : false | object Find the next available job from the specified queues using blocking list pop and return an instance of Resque_Job for it.
setJobFactory ( Resque_Job_FactoryInterface $jobFactory ) : Resque_Job
updateStatus ( integer $status ) Update the status of the current job.

Описание методов

__construct() публичный Метод

Instantiate a new instance of a job.
public __construct ( string $queue, array $payload )
$queue string The queue that the job belongs to.
$payload array array containing details of the job.

__toString() публичный Метод

Generate a string representation used to describe the current job.
public __toString ( ) : string
Результат string The string representation of the job.

create() публичный статический Метод

Create a new job and save it to the specified queue.
public static create ( string $queue, string $class, array $args = null, boolean $monitor = false, string $id = null ) : string
$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.
$id string Unique identifier for tracking the job. Generated if not supplied.
Результат string

fail() публичный Метод

Mark the current job as having failed.
public fail ( $exception )
$exception

getArguments() публичный Метод

Get the arguments supplied to this job.
public getArguments ( ) : array
Результат array Array of arguments.

getInstance() публичный Метод

Get the instantiated object for this job that will be performing work.
public getInstance ( ) : Resque_JobInterface
Результат Resque_JobInterface Instance of the object that this job belongs to.

getJobFactory() публичный Метод

public getJobFactory ( ) : Resque_Job_FactoryInterface
Результат Resque_Job_FactoryInterface

getStatus() публичный Метод

Return the status of the current job.
public getStatus ( ) : integer
Результат integer The status of the job as one of the Resque_Job_Status constants.

perform() публичный Метод

Actually execute a job by calling the perform method on the class associated with the job with the supplied arguments.
public perform ( ) : boolean
Результат boolean

recreate() публичный Метод

Re-queue the current job.
public recreate ( ) : string
Результат string

reserve() публичный статический Метод

Find the next available job from the specified queue and return an instance of Resque_Job for it.
public static reserve ( string $queue ) : false | object
$queue string The name of the queue to check for a job in.
Результат false | object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.

reserveBlocking() публичный статический Метод

Find the next available job from the specified queues using blocking list pop and return an instance of Resque_Job for it.
public static reserveBlocking ( array $queues, integer $timeout = null ) : false | object
$queues array
$timeout integer
Результат false | object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.

setJobFactory() публичный Метод

public setJobFactory ( Resque_Job_FactoryInterface $jobFactory ) : Resque_Job
$jobFactory Resque_Job_FactoryInterface
Результат Resque_Job

updateStatus() публичный Метод

Update the status of the current job.
public updateStatus ( integer $status )
$status integer Status constant from Resque_Job_Status indicating the current status of a job.

Описание свойств

$payload публичное свойство

Array containing details of the job.
public $payload

$queue публичное свойство

The name of the queue that this job belongs to.
public $queue

$worker публичное свойство

Instance of the Resque worker running this job.
public $worker