Class yii\queue\db\Queue
Inheritance | yii\queue\db\Queue » yii\queue\cli\Queue » yii\queue\Queue » yii\base\Component |
---|---|
Implements | yii\base\BootstrapInterface |
Db Queue
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$attempts | integer | Default attempt count | yii\queue\Queue |
$channel | string | yii\queue\db\Queue | |
$commandClass | string | Command class name | yii\queue\db\Queue |
$commandOptions | array | Of additional options of command | yii\queue\cli\Queue |
$db | \yii\db\Connection|array|string | yii\queue\db\Queue | |
$deleteReleased | boolean | Ability to delete released messages from table | yii\queue\db\Queue |
$loopConfig | array|string | yii\queue\cli\Queue | |
$messageHandler | callable|null | yii\queue\cli\Queue | |
$mutex | \yii\mutex\Mutex|array|string | yii\queue\db\Queue | |
$mutexTimeout | integer | Timeout | yii\queue\db\Queue |
$serializer | yii\queue\serializers\SerializerInterface|array | yii\queue\Queue | |
$strictJobType | boolean | Whether to enable strict job type control. | yii\queue\Queue |
$tableName | string | Table name | yii\queue\db\Queue |
$ttr | integer | Default time to reserve a job | yii\queue\Queue |
Public Methods
Method | Description | Defined By |
---|---|---|
bootstrap() | yii\queue\cli\Queue | |
clear() | Clears the queue | yii\queue\db\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\db\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 |
remove() | Removes a job by ID | yii\queue\db\Queue |
run() | Listens queue and runs each job. | yii\queue\db\Queue |
status() | yii\queue\db\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\db\Queue | |
release() | yii\queue\db\Queue | |
reserve() | Takes one message from waiting list and reserves it for handling. | yii\queue\db\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
Clears the queue
public void clear ( ) |
public void init ( ) |
protected string pushMessage ( $message, $ttr, $delay, $priority ) | ||
$message | string | |
$ttr | integer | Time to reserve in seconds |
$delay | integer | |
$priority | mixed | |
return | string | Id of a job message |
---|
protected void release ( $payload ) | ||
$payload | array |
Removes a job by ID
public boolean remove ( $id ) | ||
$id | integer | Of a job |
Takes one message from waiting list and reserves it for handling.
protected array|false reserve ( ) | ||
return | array|false | Payload |
---|---|---|
throws | \yii\base\Exception | in case it hasn't waited the lock |
Listens queue and runs each job.
public null|integer run ( $repeat, $delay = 0 ) | ||
$repeat | boolean | Whether to continue listening when queue is empty. |
$delay | integer | Number of seconds to sleep before next iteration. |
return | null|integer | Exit code. |
---|
public integer status ( $id ) | ||
$id | string | Of a job message |
return | integer | Status code |
---|