PHP Class Queue\Shell\QueueShell

Inheritance: extends Cake\Console\Shell
Show file Open project: dereuromark/cakephp-queue Class Usage Examples

Public Properties

Property Type Description
$modelClass string

Protected Properties

Property Type Description
$_exit boolean
$_taskConf array

Public Methods

Method Description
__destruct ( ) Destructor, removes pid-file
add ( ) : void Look for a Queue Task of hte passed name and try to call add() on it.
clean ( ) : void Manually trigger a Finished job cleanup.
getOptionParser ( ) : Cake\Console\ConsoleOptionParser Get option parser method to parse commandline options
initialize ( ) : void Overwrite shell initialize to dynamically load all Queue Related Tasks.
install ( ) : void Set up tables
main ( ) : void Output some basic usage Info.
reset ( ) : void Manually reset (failed) jobs for re-run.
runworker ( ) : void Run a QueueWorker loop.
settings ( ) : void Display current settings
stats ( ) : void Display some statistics about Finished Jobs.
uninstall ( ) : void Remove table and kill workers

Protected Methods

Method Description
_displayAvailableTasks ( ) : void
_exit ( integer $signal ) : void Signal handling to queue worker for clean shutdown
_getTaskConf ( ) : array Returns a List of available QueueTasks and their individual configurations.
_log ( string $type, integer | null $pid = null ) : void Timestamped log.
_logError ( string $message ) : void
_notify ( ) : void Timestamped notification.
_taskName ( string $task ) : string Output the task without Queue or Task example: QueueImageTask becomes Image on display

Method Details

__destruct() public method

Destructor, removes pid-file
public __destruct ( )

_displayAvailableTasks() protected method

protected _displayAvailableTasks ( ) : void
return void

_exit() protected method

Signal handling to queue worker for clean shutdown
protected _exit ( integer $signal ) : void
$signal integer not used
return void

_getTaskConf() protected method

Returns a List of available QueueTasks and their individual configurations.
protected _getTaskConf ( ) : array
return array

_log() protected method

Timestamped log.
protected _log ( string $type, integer | null $pid = null ) : void
$type string Log type
$pid integer | null PID of the process
return void

_logError() protected method

protected _logError ( string $message ) : void
$message string
return void

_notify() protected method

Timestamped notification.
protected _notify ( ) : void
return void

_taskName() protected method

Output the task without Queue or Task example: QueueImageTask becomes Image on display
protected _taskName ( string $task ) : string
$task string Task name
return string Cleaned task name

add() public method

A QueueTask may provide an add function to enable the user to create new jobs via commandline.
public add ( ) : void
return void

clean() public method

Manually trigger a Finished job cleanup.
public clean ( ) : void
return void

getOptionParser() public method

Get option parser method to parse commandline options
public getOptionParser ( ) : Cake\Console\ConsoleOptionParser
return Cake\Console\ConsoleOptionParser

initialize() public method

Overwrite shell initialize to dynamically load all Queue Related Tasks.
public initialize ( ) : void
return void

install() public method

Set up tables
See also: readme
public install ( ) : void
return void

main() public method

Output some basic usage Info.
public main ( ) : void
return void

reset() public method

Careful, this should not be done while a queue task is being run.
public reset ( ) : void
return void

runworker() public method

Runs a Queue Worker process which will try to find unassigned jobs in the queue which it may run and try to fetch and execute them.
public runworker ( ) : void
return void

settings() public method

Display current settings
public settings ( ) : void
return void

stats() public method

Display some statistics about Finished Jobs.
public stats ( ) : void
return void

uninstall() public method

Remove table and kill workers
public uninstall ( ) : void
return void

Property Details

$_exit protected property

protected bool $_exit
return boolean

$_taskConf protected property

protected array $_taskConf
return array

$modelClass public property

public string $modelClass
return string