class Worker (View source)

Methods

void
__construct( QueueManager $manager, FailedJobProviderInterface $failer = null, Dispatcher $events = null)

Create a new queue worker.

array
daemon( string $connectionName, string $queue = null, int $delay, int $memory = 128, int $sleep = 3, int $maxTries)

Listen to the given queue in a loop.

array
pop( string $connectionName, string $queue = null, int $delay, int $sleep = 3, int $maxTries)

Listen to the given queue.

array|null
process( string $connection, Job $job, int $maxTries, int $delay)

Process a given job from the queue.

bool
memoryExceeded( int $memoryLimit)

Determine if the memory limit has been exceeded.

void
stop()

Stop listening and bail out of the script.

void
sleep( int $seconds)

Sleep the script for a given number of seconds.

void
setDaemonExceptionHandler( ExceptionHandler $handler)

Set the exception handler to use in Daemon mode.

void
setCache( Repository $cache)

Set the cache repository implementation.

getManager()

Get the queue manager instance.

void
setManager( QueueManager $manager)

Set the queue manager instance.

Details

at line line 59
void __construct( QueueManager $manager, FailedJobProviderInterface $failer = null, Dispatcher $events = null)

Create a new queue worker.

Parameters

QueueManager $manager
FailedJobProviderInterface $failer
Dispatcher $events

Return Value

void

at line line 79
array daemon( string $connectionName, string $queue = null, int $delay, int $memory = 128, int $sleep = 3, int $maxTries)

Listen to the given queue in a loop.

Parameters

string $connectionName
string $queue
int $delay
int $memory
int $sleep
int $maxTries

Return Value

array

at line line 144
array pop( string $connectionName, string $queue = null, int $delay, int $sleep = 3, int $maxTries)

Listen to the given queue.

Parameters

string $connectionName
string $queue
int $delay
int $sleep
int $maxTries

Return Value

array

at line line 195
array|null process( string $connection, Job $job, int $maxTries, int $delay)

Process a given job from the queue.

Parameters

string $connection
Job $job
int $maxTries
int $delay

Return Value

array|null

Exceptions

Throwable

at line line 339
bool memoryExceeded( int $memoryLimit)

Determine if the memory limit has been exceeded.

Parameters

int $memoryLimit

Return Value

bool

at line line 349
void stop()

Stop listening and bail out of the script.

Return Value

void

at line line 362
void sleep( int $seconds)

Sleep the script for a given number of seconds.

Parameters

int $seconds

Return Value

void

at line line 396
void setDaemonExceptionHandler( ExceptionHandler $handler)

Set the exception handler to use in Daemon mode.

Parameters

ExceptionHandler $handler

Return Value

void

at line line 407
void setCache( Repository $cache)

Set the cache repository implementation.

Parameters

Repository $cache

Return Value

void

at line line 417
QueueManager getManager()

Get the queue manager instance.

Return Value

QueueManager

at line line 428
void setManager( QueueManager $manager)

Set the queue manager instance.

Parameters

QueueManager $manager

Return Value

void