Class yii\queue\sqs\Queue
SQS Queue.
Public 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\sqs\Queue |
$commandOptions | array | Of additional options of command | yii\queue\cli\Queue |
$key | string|null | yii\queue\sqs\Queue | |
$loopConfig | array|string | yii\queue\cli\Queue | |
$messageGroupId | string | yii\queue\sqs\Queue | |
$messageHandler | callable|null | yii\queue\cli\Queue | |
$region | string | yii\queue\sqs\Queue | |
$secret | string|null | yii\queue\sqs\Queue | |
$serializer | yii\queue\serializers\SerializerInterface|array | Json serializer by default. | yii\queue\sqs\Queue |
$strictJobType | boolean | Whether to enable strict job type control. | yii\queue\Queue |
$ttr | integer | Default time to reserve a job | yii\queue\Queue |
$url | string | yii\queue\sqs\Queue | |
$version | string | yii\queue\sqs\Queue | |
$workerPid | null|integer | yii\queue\Queue |
Public 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 |
clear() | Clears the queue. | yii\queue\sqs\Queue |
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 |
handle() | Provides public access for handleMessage |
yii\queue\sqs\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\queue\sqs\Queue |
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 |
run() | Listens queue and runs each job. | yii\queue\sqs\Queue |
status() | yii\queue\sqs\Queue | |
trigger() | Triggers an event. | yii\base\Component |
ttr() | Sets TTR for job execute. | yii\queue\Queue |
unserializeMessage() | Unserializes. | yii\queue\Queue |
Protected Methods
Method | Description | Defined By |
---|---|---|
delete() | Deletes the message after successfully handling. | yii\queue\sqs\Queue |
getClient() | yii\queue\sqs\Queue | |
getCommandId() | yii\queue\cli\Queue | |
handleMessage() | yii\queue\cli\Queue | |
pushMessage() | yii\queue\sqs\Queue | |
reserve() | Gets a single message from SQS queue and sets the visibility to reserve message. | yii\queue\sqs\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_LOOP | yii\queue\cli\WorkerEvent | That is triggered each iteration between requests to queue. (available since version 2.0.3) | yii\queue\cli\Queue |
EVENT_WORKER_START | yii\queue\cli\WorkerEvent | That is triggered when the worker is started. (available since version 2.0.2) | yii\queue\cli\Queue |
EVENT_WORKER_STOP | yii\queue\cli\WorkerEvent | That is triggered when the worker is stopped. (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
Command class name
Command class name
public yii\queue\serializers\SerializerInterface|array $serializer = \yii\queue\serializers\JsonSerializer::class
Method Details
Clears the queue.
public void clear ( ) |
Deletes the message after successfully handling.
protected void delete ( $payload ) | ||
$payload | array |
protected \Aws\Sqs\SqsClient getClient ( ) |
Provides public access for handleMessage
public boolean handle ( $id, $message, $ttr, $attempt ) | ||
$id | String |
|
$message | String |
|
$ttr | Int |
|
$attempt | Int |
Initializes the object.
This method is invoked at the end of the constructor after the object is initialized with the given configuration.
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 |
---|
Gets a single message from SQS queue and sets the visibility to reserve message.
protected null|array reserve ( $timeout ) | ||
$timeout | integer | Number of seconds for long polling. Must be between 0 and 20. |
return | null|array | Payload. |
---|
Listens queue and runs each job.
public null|integer run ( $repeat, $timeout = 0 ) | ||
$repeat | boolean | Whether to continue listening when queue is empty. |
$timeout | 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 |
---|