Abstract Class yii\queue\cli\Queue
Inheritance | yii\queue\cli\Queue » yii\queue\Queue » yii\base\Component |
---|---|
Implements | yii\base\BootstrapInterface |
Subclasses | yii\queue\amqp\Queue, yii\queue\amqp_interop\Queue, yii\queue\beanstalk\Queue, yii\queue\db\Queue, yii\queue\file\Queue, yii\queue\gearman\Queue, yii\queue\redis\Queue |
Queue with CLI
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$attempts | integer | Default attempt count | yii\queue\Queue |
$commandClass | string | Command class name | yii\queue\cli\Queue |
$commandOptions | array | Of additional options of command | yii\queue\cli\Queue |
$loopConfig | array|string | yii\queue\cli\Queue | |
$messageHandler | callable|null | yii\queue\cli\Queue | |
$serializer | yii\queue\serializers\SerializerInterface|array | yii\queue\Queue | |
$strictJobType | boolean | Whether to enable strict job type control. | yii\queue\Queue |
$ttr | integer | Default time to reserve a job | yii\queue\Queue |
Public Methods
Method | Description | Defined By |
---|---|---|
bootstrap() | yii\queue\cli\Queue | |
delay() | Sets delay for later execute | yii\queue\Queue |
execute() | yii\queue\cli\Queue | |
getWorkerPid() | Gets process ID of a worker. | yii\queue\cli\Queue |
handleError() | yii\queue\Queue | |
init() | yii\queue\Queue | |
isDone() | yii\queue\Queue | |
isReserved() | yii\queue\Queue | |
isWaiting() | yii\queue\Queue | |
priority() | Sets job priority | yii\queue\Queue |
push() | Pushes job into queue | yii\queue\Queue |
status() | yii\queue\Queue | |
ttr() | Sets TTR for job execute | yii\queue\Queue |
Protected Methods
Method | Description | Defined By |
---|---|---|
getCommandId() | yii\queue\cli\Queue | |
handleMessage() | yii\queue\cli\Queue | |
pushMessage() | yii\queue\Queue | |
runWorker() | Runs worker. | yii\queue\cli\Queue |
Events
Event | Type | Description | Defined By |
---|---|---|---|
EVENT_AFTER_ERROR | yii\queue\ExecEvent | yii\queue\Queue | |
EVENT_AFTER_EXEC | yii\queue\ExecEvent | yii\queue\Queue | |
EVENT_AFTER_PUSH | yii\queue\PushEvent | yii\queue\Queue | |
EVENT_BEFORE_EXEC | yii\queue\ExecEvent | yii\queue\Queue | |
EVENT_BEFORE_PUSH | yii\queue\PushEvent | yii\queue\Queue | |
EVENT_WORKER_START | yii\queue\cli\WorkerEvent | (available since version 2.0.2) | yii\queue\cli\Queue |
EVENT_WORKER_STOP | yii\queue\cli\WorkerEvent | (available since version 2.0.2) | yii\queue\cli\Queue |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
STATUS_DONE | 3 | yii\queue\Queue | |
STATUS_RESERVED | 2 | yii\queue\Queue | |
STATUS_WAITING | 1 | yii\queue\Queue |
Property Details
Method Details
public void bootstrap ( $app ) | ||
$app |
public boolean execute ( $id, $message, $ttr, $attempt, $workerPid ) | ||
$id | string | Of a message |
$message | string | |
$ttr | integer | Time to reserve |
$attempt | integer | Number |
$workerPid | integer | Of worker process |
protected string getCommandId ( ) | ||
return | string | Command id |
---|---|---|
throws |
Gets process ID of a worker.
public integer getWorkerPid ( ) |
protected boolean handleMessage ( $id, $message, $ttr, $attempt ) | ||
$id | string | Of a job message |
$message | string | |
$ttr | integer | Time to reserve |
$attempt | integer | Number |
Runs worker.
protected null|integer runWorker ( callable $handler ) | ||
$handler | callable | |
return | null|integer | Exit code |
---|