PHP Класс UrbanIndo\Yii2\Queue\Queue

С версии: 2015.02.24
Автор: Petra Barus ([email protected])
Наследование: extends yii\base\Component
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$module yii\base\Module To add the module, create a new module in the config e.g. create a module named 'task'. 'modules' => [ 'task' => [ 'class' => 'app\modules\task\Module', ] ] and then add the module to the queue config. 'components' => [ 'queue' => [ 'module' => 'task' ] ]
$releaseOnFailure boolean This will release automatically on execution failure. i.e. when the run method returns false or catch exception.
$serializer string Choose the serializer.

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

Метод Описание
delete ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Delete the job. This will trigger event EVENT_BEFORE_DELETE and EVENT_AFTER_DELETE.
fetch ( ) : UrbanIndo\Yii2\Queue\Job | boolean Return next job from the queue. This will trigger event EVENT_BEFORE_FETCH and event EVENT_AFTER_FETCH
getSize ( ) : integer Returns the number of queue size.
init ( ) : void Initializes the module.
post ( UrbanIndo\Yii2\Queue\Job &$job ) : boolean Post new job to the queue. This will trigger event EVENT_BEFORE_POST and EVENT_AFTER_POST.
purge ( ) : boolean Purge the whole queue.
release ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Release the job. This will trigger event EVENT_BEFORE_RELEASE and EVENT_AFTER_RELEASE.
run ( UrbanIndo\Yii2\Queue\Job $job ) : void Run the job.

Защищенные методы

Метод Описание
deleteJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Delete the job. Override this for the queue implementation.
deserialize ( string $message ) : UrbanIndo\Yii2\Queue\Job Deserialize job to be executed.
deserializeMessage ( array $array ) : array
fetchJob ( ) : UrbanIndo\Yii2\Queue\Job | boolean Return next job from the queue. Override this for queue implementation.
postJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Post new job to the queue. Override this for queue implementation.
releaseJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Release the job. Override this for the queue implementation.
serialize ( UrbanIndo\Yii2\Queue\Job $job ) : string Pack job so that it can be send.
serializeMessage ( mixed $array ) : array

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

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

Delete the job. This will trigger event EVENT_BEFORE_DELETE and EVENT_AFTER_DELETE.
public delete ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to delete.
Результат boolean whether the operation succeed.

deleteJob() абстрактный защищенный Метод

Delete the job. Override this for the queue implementation.
abstract protected deleteJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to delete.
Результат boolean whether the operation succeed.

deserialize() защищенный Метод

Deserialize job to be executed.
protected deserialize ( string $message ) : UrbanIndo\Yii2\Queue\Job
$message string The json string.
Результат UrbanIndo\Yii2\Queue\Job The job.

deserializeMessage() защищенный Метод

protected deserializeMessage ( array $array ) : array
$array array The message to be deserialize.
Результат array

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

Return next job from the queue. This will trigger event EVENT_BEFORE_FETCH and event EVENT_AFTER_FETCH
public fetch ( ) : UrbanIndo\Yii2\Queue\Job | boolean
Результат UrbanIndo\Yii2\Queue\Job | boolean the job or false if not found.

fetchJob() абстрактный защищенный Метод

Return next job from the queue. Override this for queue implementation.
abstract protected fetchJob ( ) : UrbanIndo\Yii2\Queue\Job | boolean
Результат UrbanIndo\Yii2\Queue\Job | boolean the job or false if not found.

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

Returns the number of queue size.
abstract public getSize ( ) : integer
Результат integer

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

Initializes the module.
public init ( ) : void
Результат void

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

Post new job to the queue. This will trigger event EVENT_BEFORE_POST and EVENT_AFTER_POST.
public post ( UrbanIndo\Yii2\Queue\Job &$job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job.
Результат boolean Whether operation succeed.

postJob() абстрактный защищенный Метод

Post new job to the queue. Override this for queue implementation.
abstract protected postJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job.
Результат boolean Whether operation succeed.

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

Purge the whole queue.
abstract public purge ( ) : boolean
Результат boolean

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

Release the job. This will trigger event EVENT_BEFORE_RELEASE and EVENT_AFTER_RELEASE.
public release ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to delete.
Результат boolean whether the operation succeed.

releaseJob() абстрактный защищенный Метод

Release the job. Override this for the queue implementation.
abstract protected releaseJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to release.
Результат boolean whether the operation succeed.

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

Run the job.
public run ( UrbanIndo\Yii2\Queue\Job $job ) : void
$job UrbanIndo\Yii2\Queue\Job The job to be executed.
Результат void

serialize() защищенный Метод

Pack job so that it can be send.
protected serialize ( UrbanIndo\Yii2\Queue\Job $job ) : string
$job UrbanIndo\Yii2\Queue\Job The job to serialize.
Результат string JSON string.

serializeMessage() защищенный Метод

protected serializeMessage ( mixed $array ) : array
$array mixed Array to serialize.
Результат array

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

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

To add the module, create a new module in the config e.g. create a module named 'task'. 'modules' => [ 'task' => [ 'class' => 'app\modules\task\Module', ] ] and then add the module to the queue config. 'components' => [ 'queue' => [ 'module' => 'task' ] ]
public Module,yii\base $module
Результат yii\base\Module

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

This will release automatically on execution failure. i.e. when the run method returns false or catch exception.
public bool $releaseOnFailure
Результат boolean

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

Choose the serializer.
public string $serializer
Результат string