/**
  * @test
  */
 public function waitAndExecuteGetsAndExecutesJobFromQueue()
 {
     $job = new TestJob();
     $this->jobManager->queue('TestQueue', $job);
     /** @var TestJob $queuedJob */
     $queuedJob = $this->jobManager->waitAndExecute('TestQueue');
     $this->assertTrue($queuedJob->getProcessed());
 }
 /**
  * @param JoinPointInterface $joinPoint The current join point
  * @return mixed
  * @Flow\Around("methodAnnotatedWith(TYPO3\Jobqueue\Common\Annotations\Defer)")
  */
 public function queueMethodCallAsJob(JoinPointInterface $joinPoint)
 {
     if ($this->processingJob) {
         return $joinPoint->getAdviceChain()->proceed($joinPoint);
     }
     $deferAnnotation = $this->reflectionService->getMethodAnnotation($joinPoint->getClassName(), $joinPoint->getMethodName(), 'TYPO3\\Jobqueue\\Common\\Annotations\\Defer');
     $queueName = $deferAnnotation->queueName;
     $job = new StaticMethodCallJob($joinPoint->getClassName(), $joinPoint->getMethodName(), $joinPoint->getMethodArguments());
     $this->jobManager->queue($queueName, $job);
     return NULL;
 }
 /**
  * List queued jobs
  *
  * @param string $queueName The name of the queue
  * @param integer $limit Number of jobs to list
  * @return void
  */
 public function listCommand($queueName, $limit = 1)
 {
     $jobs = $this->jobManager->peek($queueName, $limit);
     $totalCount = $this->queueManager->getQueue($queueName)->count();
     foreach ($jobs as $job) {
         $this->outputLine('<u>%s</u>', array($job->getLabel()));
     }
     if ($totalCount > count($jobs)) {
         $this->outputLine('(%d omitted) ...', array($totalCount - count($jobs)));
     }
     $this->outputLine('(<b>%d total</b>)', array($totalCount));
 }
 /**
  */
 protected function triggerSolrUpdate()
 {
     $job = new SolrUpdateJob('solr');
     $this->jobManager->queue('solr', $job);
 }