PHP 클래스 AppserverIo\Appserver\MessageQueue\QueueWorker

상속: extends AppserverIo\Appserver\Core\AbstractDaemonThread
파일 보기 프로젝트 열기: appserver-io/appserver 1 사용 예제들

공개 메소드들

메소드 설명
attach ( stdClass $jobWrapper ) : void Attaches a job for the passed wrapper to the worker instance.
bootstrap ( ) : void This method will be invoked before the while() loop starts and can be used to implement some bootstrap functionality.
getApplication ( ) : AppserverIo\Psr\Application\ApplicationInterface Returns the application instance the worker is bound to.
getManagerSettings ( ) : AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface Return's the queue manager settings.
getQueueTimeout ( ) : integer Returns the default timeout.
injectApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void Inject the application instance the worker is bound to.
injectJobsToExecute ( AppserverIo\Storage\GenericStackable $jobsToExecute ) : void Inject the storage for the jobs to be executed.
injectManagerSettings ( AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface $managerSettings ) : void Injects the queue manager settings.
injectMessages ( AppserverIo\Storage\GenericStackable $messages ) : void Inject the storage for the messages.
injectPriorityKey ( AppserverIo\Psr\Pms\PriorityKeyInterface $priorityKey ) : void Injects the priority of the queue worker.
log ( mixed $level, string $message, array $context = [] ) : void This is a very basic method to log some stuff by using the error_log() method of PHP.
run ( ) : void We process the messages/jobs here.

메소드 상세

attach() 공개 메소드

Attaches a job for the passed wrapper to the worker instance.
public attach ( stdClass $jobWrapper ) : void
$jobWrapper stdClass The job wrapper to attach the job for
리턴 void

bootstrap() 공개 메소드

This method will be invoked before the while() loop starts and can be used to implement some bootstrap functionality.
public bootstrap ( ) : void
리턴 void

getApplication() 공개 메소드

Returns the application instance the worker is bound to.
public getApplication ( ) : AppserverIo\Psr\Application\ApplicationInterface
리턴 AppserverIo\Psr\Application\ApplicationInterface The application instance

getManagerSettings() 공개 메소드

Return's the queue manager settings.
public getManagerSettings ( ) : AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface
리턴 AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface The queue manager settings

getQueueTimeout() 공개 메소드

Reduce CPU load depending on the queues priority, whereas priority can be 1, 2 or 3 actually, so possible values for usleep are: PriorityHigh: 100 === 0.0001 s PriorityMedium: 10.000 === 0.01 s PriorityLow: 1.000.000 === 1 s
또한 보기: AppserverIo\Appserver\Core\AbstractDaemonThread::getDefaultTimeout()
public getQueueTimeout ( ) : integer
리턴 integer The default timeout in microseconds

injectApplication() 공개 메소드

Inject the application instance the worker is bound to.
public injectApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void
$application AppserverIo\Psr\Application\ApplicationInterface The application instance
리턴 void

injectJobsToExecute() 공개 메소드

Inject the storage for the jobs to be executed.
public injectJobsToExecute ( AppserverIo\Storage\GenericStackable $jobsToExecute ) : void
$jobsToExecute AppserverIo\Storage\GenericStackable The storage for the jobs to be executed
리턴 void

injectManagerSettings() 공개 메소드

Injects the queue manager settings.
public injectManagerSettings ( AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface $managerSettings ) : void
$managerSettings AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface The queue manager settings
리턴 void

injectMessages() 공개 메소드

Inject the storage for the messages.
public injectMessages ( AppserverIo\Storage\GenericStackable $messages ) : void
$messages AppserverIo\Storage\GenericStackable The storage for the messages
리턴 void

injectPriorityKey() 공개 메소드

Injects the priority of the queue worker.
public injectPriorityKey ( AppserverIo\Psr\Pms\PriorityKeyInterface $priorityKey ) : void
$priorityKey AppserverIo\Psr\Pms\PriorityKeyInterface The priority of this queue worker
리턴 void

log() 공개 메소드

This is a very basic method to log some stuff by using the error_log() method of PHP.
public log ( mixed $level, string $message, array $context = [] ) : void
$level mixed The log level to use
$message string The message we want to log
$context array The context we of the message
리턴 void

run() 공개 메소드

We process the messages/jobs here.
public run ( ) : void
리턴 void