예제 #1
0
 /**
  * Execute a job
  *
  * @access public
  * @param Job $job
  */
 public function executeJob(Job $job)
 {
     $payload = $job->getBody();
     $className = $payload['class'];
     $this->prepareJobSession($payload['user_id']);
     if (DEBUG) {
         $this->logger->debug(__METHOD__ . ' Received job => ' . $className . ' (' . getmypid() . ')');
     }
     $worker = new $className($this->container);
     call_user_func_array(array($worker, 'execute'), $payload['params']);
 }
예제 #2
0
 /**
  * Execute a job
  *
  * @access public
  * @param Job $job
  */
 public function executeJob(Job $job)
 {
     $payload = $job->getBody();
     try {
         $className = $payload['class'];
         $this->prepareJobSession($payload['user_id']);
         $this->prepareJobEnvironment();
         if (DEBUG) {
             $this->logger->debug(__METHOD__ . ' Received job => ' . $className . ' (' . getmypid() . ')');
             $this->logger->debug(__METHOD__ . ' => ' . json_encode($payload));
         }
         $worker = new $className($this->container);
         call_user_func_array(array($worker, 'execute'), $payload['params']);
     } catch (Exception $e) {
         $this->logger->error(__METHOD__ . ': Error during job execution: ' . $e->getMessage());
         $this->logger->error(__METHOD__ . ' => ' . json_encode($payload));
     }
 }
예제 #3
0
 /**
  * Mark a job as failed
  *
  * @access public
  * @param  Job $job
  * @return $this
  */
 public function failed(Job $job)
 {
     $this->disque->queue($this->queueName)->failed(new DisqueJob($job->getBody(), $job->getId()));
     return $this;
 }
 /**
  * Mark a job as failed
  *
  * @access public
  * @param  Job $job
  * @return $this
  */
 public function failed(Job $job)
 {
     $beanstalkJob = new BeanstalkJob($job->getId(), $job->serialize());
     $this->beanstalk->bury($beanstalkJob);
     return $this;
 }
예제 #5
0
 /**
  * Mark a job as failed
  *
  * @access public
  * @param  Job $job
  * @return $this
  */
 public function failed(Job $job)
 {
     $this->sqsClient->changeMessageVisibility(array('QueueUrl' => $this->sqsUrl, 'ReceiptHandle' => $job->getId(), 'VisibilityTimeout' => 0));
     return $this;
 }
예제 #6
0
 /**
  * Mark a job as failed
  *
  * @access public
  * @param  Job $job
  * @return $this
  */
 public function failed(Job $job)
 {
     $this->queue->enqueue($job->serialize());
     return $this;
 }
예제 #7
0
 /**
  * Mark a job as failed
  *
  * @access public
  * @param  Job $job
  * @return $this
  */
 public function failed(Job $job)
 {
     $this->channel->basic_nack($job->getId());
     return $this;
 }