Listener

class Listener (View source)

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

void __construct(string $commandPath)

Create a new queue listener.

void listen(string $connection, string $queue, string $delay, string $memory, int $timeout = 60)

Listen to the given queue connection.

void runProcess(Process $process, int $memory)

Run the given process.

Process makeProcess(string $connection, string $queue, int $delay, int $memory, int $timeout)

Create a new Symfony process for the worker.

void handleWorkerOutput(int $type, string $line)

Handle output from the worker process.

bool memoryExceeded(int $memoryLimit)

Determine if the memory limit has been exceeded.

void stop()

Stop listening and bail out of the script.

void setOutputHandler(Closure $outputHandler)

Set the output handler callback.

string getEnvironment()

Get the current listener environment.

void setEnvironment(string $environment)

Set the current environment.

int getSleep()

Get the amount of seconds to wait before polling the queue.

void setSleep(int $sleep)

Set the amount of seconds to wait before polling the queue.

void setMaxTries(int $tries)

Set the amount of times to try a job before logging it failed.

Details

void __construct(string $commandPath)

Create a new queue listener.

Parameters

string $commandPath

Return Value

void

void listen(string $connection, string $queue, string $delay, string $memory, int $timeout = 60)

Listen to the given queue connection.

Parameters

string $connection
string $queue
string $delay
string $memory
int $timeout

Return Value

void

void runProcess(Process $process, int $memory)

Run the given process.

Parameters

Process $process
int $memory

Return Value

void

Process makeProcess(string $connection, string $queue, int $delay, int $memory, int $timeout)

Create a new Symfony process for the worker.

Parameters

string $connection
string $queue
int $delay
int $memory
int $timeout

Return Value

Process

protected void handleWorkerOutput(int $type, string $line)

Handle output from the worker process.

Parameters

int $type
string $line

Return Value

void

bool memoryExceeded(int $memoryLimit)

Determine if the memory limit has been exceeded.

Parameters

int $memoryLimit

Return Value

bool

void stop()

Stop listening and bail out of the script.

Return Value

void

void setOutputHandler(Closure $outputHandler)

Set the output handler callback.

Parameters

Closure $outputHandler

Return Value

void

string getEnvironment()

Get the current listener environment.

Return Value

string

void setEnvironment(string $environment)

Set the current environment.

Parameters

string $environment

Return Value

void

int getSleep()

Get the amount of seconds to wait before polling the queue.

Return Value

int

void setSleep(int $sleep)

Set the amount of seconds to wait before polling the queue.

Parameters

int $sleep

Return Value

void

void setMaxTries(int $tries)

Set the amount of times to try a job before logging it failed.

Parameters

int $tries

Return Value

void

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/4.2/Illuminate/Queue/Listener.html