Beispiel #1
0
 /**
  * @param BeanieJob $beanieJob
  */
 public function handleJob(BeanieJob $beanieJob)
 {
     $job = $this->createJobFromBeanieJob($beanieJob);
     $result = false;
     try {
         $result = $job->execute();
     } catch (\Exception $exception) {
         $this->logger->critical('Job threw exception', ['job' => $job, 'exception' => $exception]);
     }
     if ($result === false) {
         $this->jobFailureStrategy->handleFailedJob($job);
     } else {
         $job->delete();
     }
 }
Beispiel #2
0
 /**
  * @param JobFailureStrategyInterface $strategy
  * @return $this
  */
 public function withJobFailureStrategy(JobFailureStrategyInterface $strategy)
 {
     $strategy->setLogger($this->logger);
     $strategy->setConfig($this->qManConfig);
     $this->jobFailureStrategy = $strategy;
     return $this;
 }