Class yii\queue\db\Queue

Inheritanceyii\queue\db\Queue » yii\queue\cli\Queue » yii\queue\Queue » yii\base\Component
Implementsyii\base\BootstrapInterface

Db Queue

Protected Methods

Hide inherited methods

MethodDescriptionDefined 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

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
STATUS_DONE 3 yii\queue\Queue
STATUS_RESERVED 2 yii\queue\Queue
STATUS_WAITING 1 yii\queue\Queue

Property Details

$channel public property
public string $channel 'queue'
$commandClass public property

Command class name

public string $commandClass = \yii\queue\db\Command::class
$db public property
public \yii\db\Connection|array|string $db 'db'
$deleteReleased public property

Ability to delete released messages from table

public boolean $deleteReleased true
$mutex public property
public \yii\mutex\Mutex|array|string $mutex 'mutex'
$mutexTimeout public property

Timeout

$tableName public property

Table name

public string $tableName '{{%queue}}'

Method Details

clear() public method (available since version 2.0.1)

Clears the queue

public void clear ( )
init() public method

public void init ( )
pushMessage() protected method

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

release() protected method

protected void release ( $payload )
$payload array
remove() public method (available since version 2.0.1)

Removes a job by ID

public boolean remove ( $id )
$id integer

Of a job

reserve() protected method

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

run() public method (available since version 2.0.2)

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.

status() public method

public integer status ( $id )
$id string

Of a job message

return integer

Status code