Listener
class Listener
Properties
protected string | $commandPath | The command working path. |
|
protected string | $environment | The environment the workers should run under. |
|
protected int | $sleep | The amount of seconds to wait before polling the queue. |
|
protected int | $maxTries | The amount of times to try a job before logging it failed. |
|
protected string | $workerCommand | The queue worker command line. |
|
protected Closure|null | $outputHandler | The output handler callback. |
Methods
Create a new queue listener.
Build the environment specific worker command.
Get the PHP binary.
Get the Artisan binary.
Listen to the given queue connection.
Create a new Symfony process for the worker.
Add the environment option to the given command.
Format the given command with the listener options.
Run the given process.
Handle output from the worker process.
Determine if the memory limit has been exceeded.
Stop listening and bail out of the script.
Details
at line 60
void
__construct(string $commandPath)
Create a new queue listener.
at line 71
protected string
buildCommandTemplate()
Build the environment specific worker command.
at line 83
protected string
phpBinary()
Get the PHP binary.
at line 95
protected string
artisanBinary()
Get the Artisan binary.
at line 110
void
listen(string $connection, string $queue, ListenerOptions $options)
Listen to the given queue connection.
at line 127
Process
makeProcess(string $connection, string $queue, ListenerOptions $options)
Create a new Symfony process for the worker.
at line 157
protected string
addEnvironment(string $command, ListenerOptions $options)
Add the environment option to the given command.
at line 171
protected string
formatCommand(string $command, string $connection, string $queue, ListenerOptions $options)
Format the given command with the listener options.
at line 189
void
runProcess(Process $process, int $memory)
Run the given process.
at line 210
protected void
handleWorkerOutput(int $type, string $line)
Handle output from the worker process.
at line 223
bool
memoryExceeded(int $memoryLimit)
Determine if the memory limit has been exceeded.
at line 233
void
stop()
Stop listening and bail out of the script.
at line 244
void
setOutputHandler(Closure $outputHandler)
Set the output handler callback.