yii\queue\cli\Queue - Yii2 类参考手册

Abstract Class yii\queue\cli\Queue

Inheritanceyii\queue\cli\Queue » yii\queue\Queue » yii\base\Component » yii\base\BaseObject
Implementsyii\base\BootstrapInterface, yii\base\Configurable
Subclassesyii\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

隐藏继承的属性 Hide inherited properties

属性Property类型 Type简介 Description定义在 Defined By
$attempts integer Default attempt count yii\queue\Queue
$behaviors yii\base\Behavior[] List of behaviors attached to this component yii\base\Component
$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
$workerPid integer yii\queue\cli\Queue

Public Methods

隐藏继承的方法 Hide inherited methods

方法 Method简介 Description定义在 Defined By
__call() Calls the named method which is not a class method. yii\base\Component
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of a component property. yii\base\Component
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Component
__set() Sets the value of a component property. yii\base\Component
__unset() Sets a component property to be null. yii\base\Component
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
bootstrap() Bootstrap method to be called during application bootstrap stage. yii\queue\cli\Queue
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Component
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Component
className() Returns the fully qualified name of this class. yii\base\BaseObject
delay() Sets delay for later execute yii\queue\Queue
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
execute() yii\queue\cli\Queue
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
getWorkerPid() Gets process ID of a worker. yii\queue\cli\Queue
handleError() yii\queue\Queue
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() Initializes the object. yii\base\BaseObject
isDone() yii\queue\Queue
isReserved() yii\queue\Queue
isWaiting() yii\queue\Queue
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
priority() Sets job priority yii\queue\Queue
push() Pushes job into queue yii\queue\Queue
status() yii\queue\Queue
trigger() Triggers an event. yii\base\Component
ttr() Sets TTR for job execute yii\queue\Queue

常量 Constants

隐藏继承的常量 Hide inherited 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

$commandClass public property

Command class name

public string $commandClass = \yii\queue\cli\Command::class
$commandOptions public property

Of additional options of command

public array $commandOptions = []
$loopConfig public property (available since version 2.0.2)
public array|string $loopConfig = \yii\queue\cli\SignalLoop::class
$messageHandler public property
$workerPid public read-only property

方法详情 Method Details

bootstrap() public method

Bootstrap method to be called during application bootstrap stage.

public void bootstrap ( $app )
$app yii\base\Application

The application currently running

execute() public method

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

getCommandId() protected method

protected string getCommandId ( )
return string

Command id

throws
getWorkerPid() public method (available since version 2.0.2)

Gets process ID of a worker.

public integer getWorkerPid ( )
handleMessage() protected method

protected boolean handleMessage ( $id, $message, $ttr, $attempt )
$id string

Of a job message

$message string
$ttr integer

Time to reserve

$attempt integer

Number

runWorker() protected method (available since version 2.0.2)

Runs worker.

protected null|integer runWorker ( callable $handler )
$handler callable
return null|integer

Exit code

事件详情 Event Details

EVENT_WORKER_START event of type yii\queue\cli\WorkerEvent (available since version 2.0.2)
EVENT_WORKER_STOP event of type yii\queue\cli\WorkerEvent (available since version 2.0.2)