Listener
class Listener
Properties
| 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 number of times to try a job before logging it failed. |
|
| protected Closure|null | $outputHandler | The output handler callback. |
Methods
Create a new queue listener.
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.
Create the 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 38
__construct(string $commandPath)
Create a new queue listener.
at line 46
protected string
phpBinary()
Get the PHP binary.
at line 54
protected string
artisanBinary()
Get the Artisan binary.
at line 62
void
listen(string|null $connection, string $queue, ListenerOptions $options)
Listen to the given queue connection.
at line 78
Process
makeProcess(string|null $connection, string $queue, ListenerOptions $options)
Create a new Symfony process for the worker.
at line 105
protected array
addEnvironment(array $command, ListenerOptions $options)
Add the environment option to the given command.
at line 113
protected array
createCommand(string|null $connection, string $queue, ListenerOptions $options)
Create the command with the listener options.
at line 136
void
runProcess(Process $process, float $memory)
Run the given process.
at line 153
protected void
handleWorkerOutput(string $type, string $line)
Handle output from the worker process.
at line 163
bool
memoryExceeded(float $memoryLimit)
Determine if the memory limit has been exceeded.
at line 173
never
stop()
Stop listening and bail out of the script.
at line 184
void
setOutputHandler(Closure $outputHandler)
Set the output handler callback.
Boot-only. The callback persists on the singleton listener for the command lifetime and handles every subsequent worker output line.