PHP 클래스 Illuminate\Queue\Worker

파일 보기 프로젝트 열기: illuminate/queue 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$cache Illuminate\Contracts\Cache\Repository The cache repository implementation.
$events Illuminate\Contracts\Events\Dispatcher The event dispatcher instance.
$exceptions Illuminate\Foundation\Exceptions\Handler The exception handler instance.
$manager Illuminate\Queue\QueueManager The queue manager instance.

공개 메소드들

메소드 설명
__construct ( Illuminate\Queue\QueueManager $manager, Illuminate\Contracts\Events\Dispatcher $events, Illuminate\Contracts\Debug\ExceptionHandler $exceptions ) : void Create a new queue worker.
daemon ( string $connectionName, string $queue, WorkerOptions $options ) : void Listen to the given queue in a loop.
getManager ( ) : Illuminate\Queue\QueueManager Get the queue manager instance.
memoryExceeded ( integer $memoryLimit ) : boolean Determine if the memory limit has been exceeded.
process ( string $connectionName, Illuminate\Contracts\Queue\Job $job, WorkerOptions $options ) : void Process a given job from the queue.
runNextJob ( string $connectionName, string $queue, WorkerOptions $options ) : void Process the next job on the queue.
setCache ( Illuminate\Contracts\Cache\Repository $cache ) : void Set the cache repository implementation.
setManager ( Illuminate\Queue\QueueManager $manager ) : void Set the queue manager instance.
sleep ( integer $seconds ) : void Sleep the script for a given number of seconds.
stop ( ) : void Stop listening and bail out of the script.

보호된 메소드들

메소드 설명
daemonShouldRun ( WorkerOptions $options ) : boolean Determine if the daemon should process on this iteration.
failJob ( string $connectionName, Illuminate\Contracts\Queue\Job $job, Exception $e ) : void Mark the given job as failed and raise the relevant event.
getNextJob ( Illuminate\Contracts\Queue\Queue $connection, string $queue ) : Illuminate\Contracts\Queue\Job | null Get the next job from the queue connection.
getTimestampOfLastQueueRestart ( ) : integer | null Get the last queue restart timestamp, or null.
handleJobException ( string $connectionName, Illuminate\Contracts\Queue\Job $job, WorkerOptions $options, Exception $e ) : void Handle an exception that occurred while the job was running.
markJobAsFailedIfAlreadyExceedsMaxAttempts ( string $connectionName, Illuminate\Contracts\Queue\Job $job, integer $maxTries ) : void Mark the given job as failed if it has exceeded the maximum allowed attempts.
markJobAsFailedIfHasExceededMaxAttempts ( string $connectionName, Illuminate\Contracts\Queue\Job $job, integer $maxTries, Exception $e ) : void Mark the given job as failed if it has exceeded the maximum allowed attempts.
queueShouldRestart ( integer | null $lastRestart ) : boolean Determine if the queue worker should restart.
raiseAfterJobEvent ( string $connectionName, Illuminate\Contracts\Queue\Job $job ) : void Raise the after queue job event.
raiseBeforeJobEvent ( string $connectionName, Illuminate\Contracts\Queue\Job $job ) : void Raise the before queue job event.
raiseExceptionOccurredJobEvent ( string $connectionName, Illuminate\Contracts\Queue\Job $job, Exception $e ) : void Raise the exception occurred queue job event.
raiseFailedJobEvent ( string $connectionName, Illuminate\Contracts\Queue\Job $job, Exception $e ) : void Raise the failed queue job event.
registerTimeoutHandler ( Illuminate\Contracts\Queue\Job | null $job, WorkerOptions $options ) : void Register the worker timeout handler (PHP 7.1+).
runJob ( Illuminate\Contracts\Queue\Job $job, string $connectionName, WorkerOptions $options ) : void Process the given job.

메소드 상세

__construct() 공개 메소드

Create a new queue worker.
public __construct ( Illuminate\Queue\QueueManager $manager, Illuminate\Contracts\Events\Dispatcher $events, Illuminate\Contracts\Debug\ExceptionHandler $exceptions ) : void
$manager Illuminate\Queue\QueueManager
$events Illuminate\Contracts\Events\Dispatcher
$exceptions Illuminate\Contracts\Debug\ExceptionHandler
리턴 void

daemon() 공개 메소드

Listen to the given queue in a loop.
public daemon ( string $connectionName, string $queue, WorkerOptions $options ) : void
$connectionName string
$queue string
$options WorkerOptions
리턴 void

daemonShouldRun() 보호된 메소드

Determine if the daemon should process on this iteration.
protected daemonShouldRun ( WorkerOptions $options ) : boolean
$options WorkerOptions
리턴 boolean

failJob() 보호된 메소드

Mark the given job as failed and raise the relevant event.
protected failJob ( string $connectionName, Illuminate\Contracts\Queue\Job $job, Exception $e ) : void
$connectionName string
$job Illuminate\Contracts\Queue\Job
$e Exception
리턴 void

getManager() 공개 메소드

Get the queue manager instance.
public getManager ( ) : Illuminate\Queue\QueueManager
리턴 Illuminate\Queue\QueueManager

getNextJob() 보호된 메소드

Get the next job from the queue connection.
protected getNextJob ( Illuminate\Contracts\Queue\Queue $connection, string $queue ) : Illuminate\Contracts\Queue\Job | null
$connection Illuminate\Contracts\Queue\Queue
$queue string
리턴 Illuminate\Contracts\Queue\Job | null

getTimestampOfLastQueueRestart() 보호된 메소드

Get the last queue restart timestamp, or null.

handleJobException() 보호된 메소드

Handle an exception that occurred while the job was running.
protected handleJobException ( string $connectionName, Illuminate\Contracts\Queue\Job $job, WorkerOptions $options, Exception $e ) : void
$connectionName string
$job Illuminate\Contracts\Queue\Job
$options WorkerOptions
$e Exception
리턴 void

markJobAsFailedIfAlreadyExceedsMaxAttempts() 보호된 메소드

This will likely be because the job previously exceeded a timeout.
protected markJobAsFailedIfAlreadyExceedsMaxAttempts ( string $connectionName, Illuminate\Contracts\Queue\Job $job, integer $maxTries ) : void
$connectionName string
$job Illuminate\Contracts\Queue\Job
$maxTries integer
리턴 void

markJobAsFailedIfHasExceededMaxAttempts() 보호된 메소드

Mark the given job as failed if it has exceeded the maximum allowed attempts.
protected markJobAsFailedIfHasExceededMaxAttempts ( string $connectionName, Illuminate\Contracts\Queue\Job $job, integer $maxTries, Exception $e ) : void
$connectionName string
$job Illuminate\Contracts\Queue\Job
$maxTries integer
$e Exception
리턴 void

memoryExceeded() 공개 메소드

Determine if the memory limit has been exceeded.
public memoryExceeded ( integer $memoryLimit ) : boolean
$memoryLimit integer
리턴 boolean

process() 공개 메소드

Process a given job from the queue.
public process ( string $connectionName, Illuminate\Contracts\Queue\Job $job, WorkerOptions $options ) : void
$connectionName string
$job Illuminate\Contracts\Queue\Job
$options WorkerOptions
리턴 void

queueShouldRestart() 보호된 메소드

Determine if the queue worker should restart.
protected queueShouldRestart ( integer | null $lastRestart ) : boolean
$lastRestart integer | null
리턴 boolean

raiseAfterJobEvent() 보호된 메소드

Raise the after queue job event.
protected raiseAfterJobEvent ( string $connectionName, Illuminate\Contracts\Queue\Job $job ) : void
$connectionName string
$job Illuminate\Contracts\Queue\Job
리턴 void

raiseBeforeJobEvent() 보호된 메소드

Raise the before queue job event.
protected raiseBeforeJobEvent ( string $connectionName, Illuminate\Contracts\Queue\Job $job ) : void
$connectionName string
$job Illuminate\Contracts\Queue\Job
리턴 void

raiseExceptionOccurredJobEvent() 보호된 메소드

Raise the exception occurred queue job event.
protected raiseExceptionOccurredJobEvent ( string $connectionName, Illuminate\Contracts\Queue\Job $job, Exception $e ) : void
$connectionName string
$job Illuminate\Contracts\Queue\Job
$e Exception
리턴 void

raiseFailedJobEvent() 보호된 메소드

Raise the failed queue job event.
protected raiseFailedJobEvent ( string $connectionName, Illuminate\Contracts\Queue\Job $job, Exception $e ) : void
$connectionName string
$job Illuminate\Contracts\Queue\Job
$e Exception
리턴 void

registerTimeoutHandler() 보호된 메소드

Register the worker timeout handler (PHP 7.1+).
protected registerTimeoutHandler ( Illuminate\Contracts\Queue\Job | null $job, WorkerOptions $options ) : void
$job Illuminate\Contracts\Queue\Job | null
$options WorkerOptions
리턴 void

runJob() 보호된 메소드

Process the given job.
protected runJob ( Illuminate\Contracts\Queue\Job $job, string $connectionName, WorkerOptions $options ) : void
$job Illuminate\Contracts\Queue\Job
$connectionName string
$options WorkerOptions
리턴 void

runNextJob() 공개 메소드

Process the next job on the queue.
public runNextJob ( string $connectionName, string $queue, WorkerOptions $options ) : void
$connectionName string
$queue string
$options WorkerOptions
리턴 void

setCache() 공개 메소드

Set the cache repository implementation.
public setCache ( Illuminate\Contracts\Cache\Repository $cache ) : void
$cache Illuminate\Contracts\Cache\Repository
리턴 void

setManager() 공개 메소드

Set the queue manager instance.
public setManager ( Illuminate\Queue\QueueManager $manager ) : void
$manager Illuminate\Queue\QueueManager
리턴 void

sleep() 공개 메소드

Sleep the script for a given number of seconds.
public sleep ( integer $seconds ) : void
$seconds integer
리턴 void

stop() 공개 메소드

Stop listening and bail out of the script.
public stop ( ) : void
리턴 void

프로퍼티 상세

$cache 보호되어 있는 프로퍼티

The cache repository implementation.
protected Repository,Illuminate\Contracts\Cache $cache
리턴 Illuminate\Contracts\Cache\Repository

$events 보호되어 있는 프로퍼티

The event dispatcher instance.
protected Dispatcher,Illuminate\Contracts\Events $events
리턴 Illuminate\Contracts\Events\Dispatcher

$exceptions 보호되어 있는 프로퍼티

The exception handler instance.
protected Handler,Illuminate\Foundation\Exceptions $exceptions
리턴 Illuminate\Foundation\Exceptions\Handler

$manager 보호되어 있는 프로퍼티

The queue manager instance.
protected QueueManager,Illuminate\Queue $manager
리턴 Illuminate\Queue\QueueManager