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
Datei anzeigen Open project: urbanindo/yii2-queue

Public Properties

Property Type Description
$queue the name of the queue component. default to 'queue'.
$sleepTimeout sleep timeout for infinite loop in second

Public Methods

Method 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.

Protected Methods

Method 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 method

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'.
return void

actionPeek() public method

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

actionPost() public method

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

actionPurge() public method

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

actionRun() public method

Fetch a job from the queue.
public actionRun ( ) : void
return void

actionRunTask() public method

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.
return void

actionTest() public method

public actionTest ( ) : void
return void

createJob() protected method

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.
return UrbanIndo\Yii2\Queue\Job

getScriptPath() protected method

Returns the script path.
protected getScriptPath ( ) : string
return string

init() public method

public init ( ) : void
return void

initSignalHandler() protected method

Initialize signal handler for the process.
protected initSignalHandler ( ) : void
return void

options() public method

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

runQueueFetching() protected method

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.
return void

setName() public method

Sets the name of the command. This should be overriden in the config.
public setName ( string $value ) : void
$value string The value.
return 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