/**
  * {@inheritDoc}
  */
 public function processJob(JobInterface $job, QueueInterface $queue)
 {
     if (!$queue instanceof DoctrineQueueInterface) {
         return;
     }
     try {
         $job->execute($queue);
         $queue->delete($job);
     } catch (JobException\ReleasableException $exception) {
         $queue->release($job, $exception->getOptions());
     } catch (JobException\BuryableException $exception) {
         $queue->bury($job, $exception->getOptions());
     } catch (Exception $exception) {
         $queue->bury($job, array('message' => $exception->getMessage(), 'trace' => $exception->getTraceAsString()));
     }
 }
 /**
  * {@inheritDoc}
  */
 public function processJob(JobInterface $job, QueueInterface $queue)
 {
     if (!$queue instanceof BeanstalkdQueueInterface) {
         return WorkerEvent::JOB_STATUS_UNKNOWN;
     }
     /**
      * In Beanstalkd, if an error occurs (exception for instance), the job
      * is automatically reinserted into the queue after a configured delay
      * (the "visibility_timeout" option). If the job executed correctly, it
      * must explicitly be removed
      */
     try {
         $job->execute();
         $queue->delete($job);
         return WorkerEvent::JOB_STATUS_SUCCESS;
     } catch (Exception $exception) {
         // Do nothing, the job will be reinserted automatically for another try
         return WorkerEvent::JOB_STATUS_FAILURE_RECOVERABLE;
     }
 }
Beispiel #3
0
 /**
  * {@inheritDoc}
  */
 public function processJob(JobInterface $job, QueueInterface $queue)
 {
     if (!$queue instanceof SqsQueueInterface) {
         return WorkerEvent::JOB_STATUS_UNKNOWN;
     }
     // In SQS, if an error occurs (exception for instance), the job is automatically reinserted
     // into the queue after a configured delay (the "visibility_timeout" option). If the job executed
     // correctly, it must explicitly be removed
     try {
         $job->execute();
         $queue->delete($job);
         return WorkerEvent::JOB_STATUS_SUCCESS;
     } catch (SqsException $sqsException) {
         // We want to retrigger SQS exception as they may include useful debugging information like lack of
         // permissions
         throw $sqsException;
     } catch (Exception $exception) {
         // Do nothing, the job will be reinserted automatically for another try
         return WorkerEvent::JOB_STATUS_FAILURE_RECOVERABLE;
     }
 }
 public function processJob(JobInterface $job, QueueInterface $queue)
 {
     return $job->execute();
 }