Property | Type | Description | |
---|---|---|---|
$demonize | boolean Run controller as Daemon | ||
$isMultiInstance | boolean allow daemon create a few instances | ||
$maxChildProcesses | int max daemon instances |
Property | Type | Description | |
---|---|---|---|
$currentJobs | [] array of running instances | ||
$logDir | |||
$memoryLimit | Memory limit for daemon, must bee less than php memory_limit | ||
$parentPID | int main procces pid | ||
$pidDir | |||
$sleep | Delay between task list checking |
Method | Description | |
---|---|---|
__destruct ( ) | ||
actionIndex ( ) : boolean | Base action, you can\t override or create another actions | |
beforeAction ( |
Prevent non index action running | |
getPidPath ( string $daemon = null ) : string | ||
getProcessName ( $route = null ) : string | ||
init ( ) | Init function | |
options ( string $actionID ) : array | Возвращает доступные опции | |
runDaemon ( string $job ) : boolean | Tasks runner | |
signalHandler ( $signo, null $pid = null, null $status = null ) | PCNTL signals handler | |
stderr ( string $string ) : integer | If in daemon mode - no write to console | |
stdout ( string $string ) : boolean | integer | If in daemon mode - no write to console |
Method | Description | |
---|---|---|
changeProcessName ( ) | Set new process name | |
cleanLog ( ) | Empty log queue | |
closeStdStreams ( ) | Close std streams and open to /dev/null need some class properties | |
defineJobExtractor ( &$jobs ) : mixed | Fetch one task from array of tasks | |
defineJobs ( ) : array | Extract current unprocessed jobs You can extract jobs from DB (DataProvider will be great), queue managers (ZMQ, RabbiMQ etc), redis and so on | |
deletePid ( ) | Delete pid file | |
doJob ( $job ) : boolean | Daemon worker body | |
flushLog ( $final = false ) | Empty log queue | |
halt ( $code, $message = null ) | Stop process and show or write message | |
initLogger ( ) | Adjusting logger. You can override it. | |
renewConnections ( ) | Renew connections |
Method | Description | |
---|---|---|
loop ( ) : boolean | Main Loop | |
writeConsole ( $message ) | Show message in console |
final public actionIndex ( ) : boolean | ||
return | boolean |
public beforeAction ( |
||
$action | ||
return | boolean |
protected closeStdStreams ( ) |
protected defineJobExtractor ( &$jobs ) : mixed | ||
return | mixed | one task |
abstract protected defineJobs ( ) : array | ||
return | array | with jobs |
public getPidPath ( string $daemon = null ) : string | ||
$daemon | string | |
return | string |
protected halt ( $code, $message = null ) | ||
$code | int -1|0|1 | |
$message | string |
final static public signalHandler ( $signo, null $pid = null, null $status = null ) | ||
$signo | ||
$pid | null | |
$status | null |
protected static $currentJobs |
public $isMultiInstance |
protected $memoryLimit |