PHP Класс Mmoreram\GearmanBundle\Service\GearmanExecute

С версии: 2.3.1
Наследование: extends Mmoreram\GearmanBundle\Service\Abstracts\AbstractGearmanService
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$eventDispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface EventDispatcher instance
$executeOptionsResolver Symfony\Component\OptionsResolver\OptionsResolver
$output Symfony\Component\Console\Output\OutputInterface Output instance
$stopWorkSignalReceived boolean Boolean to track if a system signal has been received

Открытые методы

Метод Описание
__construct ( Mmoreram\GearmanBundle\Service\GearmanCacheWrapper $gearmanCacheWrapper, array $defaultSettings ) Construct method
executeJob ( string $jobName, array $options = [], GearmanWorker $gearmanWorker = null ) Executes a job given a jobName and given settings and annotations of job
executeWorker ( string $workerName, array $options = [] ) Executes a worker given a workerName subscribing all his jobs inside and given settings and annotations of worker and jobs
handleJob ( GearmanJob $job, mixed $context ) : mixed Wrapper function handler for all registered functions This allows us to do some nice logging when jobs are started/finished
handleSystemSignal ( $signo ) Toggles that work should be stopped, we only subscribe to SIGTERM and SIGHUP
setContainer ( Symfony\Component\DependencyInjection\ContainerInterface $container ) : GearmanExecute Set container
setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher ) : GearmanExecute Set event dispatcher
setOutput ( Symfony\Component\Console\Output\OutputInterface $output ) : GearmanExecute Set output

Приватные методы

Метод Описание
addServers ( GearmanWorker $gmworker, array $servers ) : array Adds into worker all defined Servers.
callJob ( array $worker, array $options = [], GearmanWorker $gearmanWorker = null ) : GearmanExecute Given a worker, execute GearmanWorker function defined by job.
createJob ( array $worker ) : Object Given a worker settings, return Job instance
runJob ( GearmanWorker $gearmanWorker, Object $objInstance, array $jobs, integer $iterations, integer $timeout = null ) : GearmanExecute Given a GearmanWorker and an instance of Job, run it

Описание методов

__construct() публичный Метод

Construct method
public __construct ( Mmoreram\GearmanBundle\Service\GearmanCacheWrapper $gearmanCacheWrapper, array $defaultSettings )
$gearmanCacheWrapper Mmoreram\GearmanBundle\Service\GearmanCacheWrapper GearmanCacheWrapper
$defaultSettings array The default settings for the bundle

executeJob() публичный Метод

Executes a job given a jobName and given settings and annotations of job
public executeJob ( string $jobName, array $options = [], GearmanWorker $gearmanWorker = null )
$jobName string Name of job to be executed
$options array Array of options passed to the callback
$gearmanWorker GearmanWorker Worker instance to use

executeWorker() публичный Метод

Executes a worker given a workerName subscribing all his jobs inside and given settings and annotations of worker and jobs
public executeWorker ( string $workerName, array $options = [] )
$workerName string Name of worker to be executed
$options array

handleJob() публичный Метод

Wrapper function handler for all registered functions This allows us to do some nice logging when jobs are started/finished
См. также: https://github.com/brianlmoon/GearmanManager/blob/ffc828dac2547aff76cb4962bb3fcc4f454ec8a2/GearmanPeclManager.php#L95-206
public handleJob ( GearmanJob $job, mixed $context ) : mixed
$job GearmanJob
$context mixed
Результат mixed

handleSystemSignal() публичный Метод

Toggles that work should be stopped, we only subscribe to SIGTERM and SIGHUP
public handleSystemSignal ( $signo )

setContainer() публичный Метод

Set container
public setContainer ( Symfony\Component\DependencyInjection\ContainerInterface $container ) : GearmanExecute
$container Symfony\Component\DependencyInjection\ContainerInterface Container
Результат GearmanExecute self Object

setEventDispatcher() публичный Метод

Set event dispatcher
public setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher ) : GearmanExecute
$eventDispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
Результат GearmanExecute self Object

setOutput() публичный Метод

Set output
public setOutput ( Symfony\Component\Console\Output\OutputInterface $output ) : GearmanExecute
$output Symfony\Component\Console\Output\OutputInterface
Результат GearmanExecute self Object

Описание свойств

$eventDispatcher защищенное свойство

EventDispatcher instance
protected EventDispatcherInterface,Symfony\Component\EventDispatcher $eventDispatcher
Результат Symfony\Component\EventDispatcher\EventDispatcherInterface

$executeOptionsResolver защищенное свойство

protected OptionsResolver,Symfony\Component\OptionsResolver $executeOptionsResolver
Результат Symfony\Component\OptionsResolver\OptionsResolver

$output защищенное свойство

Output instance
protected OutputInterface,Symfony\Component\Console\Output $output
Результат Symfony\Component\Console\Output\OutputInterface

$stopWorkSignalReceived защищенное свойство

Boolean to track if a system signal has been received
protected bool $stopWorkSignalReceived
Результат boolean