PHP Class UrbanIndo\Yii2\Queue\Console\Controller

To use the controller, update the controllerMap. return [ ... 'controllerMap' => [ 'queue' => 'UrbanIndo\Yii2\Queue\Console\QueueController' ], ]; OR return [ ... 'controllerMap' => [ 'queue' => [ 'class' => 'UrbanIndo\Yii2\Queue\Console\QueueController', 'sleepTimeout' => 1 ] ], ]; To run yii queue
Since: 2015.02.24
Author: Petra Barus ([email protected])
Inheritance: extends yii\console\Controller
Afficher le fichier Open project: urbanindo/yii2-queue

Méthodes publiques

Свойство Type Description
$queue the name of the queue component. default to 'queue'.
$sleepTimeout sleep timeout for infinite loop in second

Méthodes publiques

Méthode Description
actionListen ( string $cwd = null, integer $timeout = null, array $env = [] ) : void This will continuously run new subprocesses to fetch job from the queue.
actionPeek ( integer $count = 1 ) : void Peek messages from queue that are still active.
actionPost ( string $route, string $data = '{}' ) : void Post a job to the queue.
actionPurge ( integer $count = 1 ) : void Purging messages from queue that are still active.
actionRun ( ) : void Fetch a job from the queue.
actionRunTask ( string $route, string $data = '{}' ) : void Run a task without going to queue.
actionTest ( ) : void
init ( ) : void
options ( string $actionID ) : array
setName ( string $value ) : void Sets the name of the command. This should be overriden in the config.

Méthodes protégées

Méthode Description
createJob ( string $route, string $data = '{}' ) : UrbanIndo\Yii2\Queue\Job Create a job from route and data.
getScriptPath ( ) : string Returns the script path.
initSignalHandler ( ) : void Initialize signal handler for the process.
runQueueFetching ( string $command, string $cwd = null, integer $timeout = null, array $env = [] ) : void Run the queue fetching process.

Method Details

actionListen() public méthode

This will continuously run new subprocesses to fetch job from the queue.
public actionListen ( string $cwd = null, integer $timeout = null, array $env = [] ) : void
$cwd string The working directory.
$timeout integer Timeout.
$env array The environment to passed to the sub process. The format for each element is 'KEY=VAL'.
Résultat void

actionPeek() public méthode

Peek messages from queue that are still active.
public actionPeek ( integer $count = 1 ) : void
$count integer Number of messages to peek.
Résultat void

actionPost() public méthode

Post a job to the queue.
public actionPost ( string $route, string $data = '{}' ) : void
$route string The route.
$data string The data in JSON format.
Résultat void

actionPurge() public méthode

Purging messages from queue that are still active.
public actionPurge ( integer $count = 1 ) : void
$count integer Number of messages to delete.
Résultat void

actionRun() public méthode

Fetch a job from the queue.
public actionRun ( ) : void
Résultat void

actionRunTask() public méthode

This is useful to test the task controller.
public actionRunTask ( string $route, string $data = '{}' ) : void
$route string The route.
$data string The data in JSON format.
Résultat void

actionTest() public méthode

public actionTest ( ) : void
Résultat void

createJob() protected méthode

Create a job from route and data.
protected createJob ( string $route, string $data = '{}' ) : UrbanIndo\Yii2\Queue\Job
$route string The route.
$data string The JSON data.
Résultat UrbanIndo\Yii2\Queue\Job

getScriptPath() protected méthode

Returns the script path.
protected getScriptPath ( ) : string
Résultat string

init() public méthode

public init ( ) : void
Résultat void

initSignalHandler() protected méthode

Initialize signal handler for the process.
protected initSignalHandler ( ) : void
Résultat void

options() public méthode

public options ( string $actionID ) : array
$actionID string The action id of the current request.
Résultat array the names of the options valid for the action

runQueueFetching() protected méthode

Run the queue fetching process.
protected runQueueFetching ( string $command, string $cwd = null, integer $timeout = null, array $env = [] ) : void
$command string The command.
$cwd string The working directory.
$timeout integer The timeout.
$env array The environment to be passed.
Résultat void

setName() public méthode

Sets the name of the command. This should be overriden in the config.
public setName ( string $value ) : void
$value string The value.
Résultat void

Property Details

$queue public_oe property

the name of the queue component. default to 'queue'.
public $queue

$sleepTimeout public_oe property

sleep timeout for infinite loop in second
public $sleepTimeout