/**
  * Wait and get job from a queue
  *
  * @access public
  * @return Job|null
  */
 public function pull()
 {
     try {
         $job = new Job();
         $payload = $this->queue->dequeue();
         return $job->unserialize($payload);
     } catch (Exception $e) {
         return null;
     }
 }
 /**
  * Wait and get job from a queue
  *
  * @access public
  * @return Job|null
  */
 public function pull()
 {
     $beanstalkJob = $this->beanstalk->reserveFromTube($this->queueName);
     if ($beanstalkJob === false) {
         return null;
     }
     $job = new Job();
     $job->setId($beanstalkJob->getId());
     $job->unserialize($beanstalkJob->getData());
     return $job;
 }
 /**
  * Wait and get job from a queue
  *
  * @access public
  * @return Job|null
  */
 public function pull()
 {
     $result = $this->sqsClient->receiveMessage(array('QueueUrl' => $this->sqsUrl, 'WaitTimeSeconds' => empty($this->config['LongPollingTime']) ? 0 : (int) $this->config['LongPollingTime']));
     if ($result['Messages'] == null) {
         return null;
     }
     $resultMessage = array_pop($result['Messages']);
     $job = new Job();
     $job->setId($resultMessage['ReceiptHandle']);
     $job->unserialize($resultMessage['Body']);
     return $job;
 }
 /**
  * Wait and get job from a queue
  *
  * @access public
  * @return Job|null
  */
 public function pull()
 {
     $message = null;
     $this->channel->basic_consume($this->queue, 'test', false, false, false, false, function ($msg) use(&$message) {
         $message = $msg;
         $message->delivery_info['channel']->basic_cancel($message->delivery_info['consumer_tag']);
     });
     while (count($this->channel->callbacks)) {
         $this->channel->wait();
     }
     if ($message === null) {
         return null;
     }
     $job = new Job();
     $job->setId($message->get('delivery_tag'));
     $job->unserialize($message->getBody());
     return $job;
 }