Example #1
0
 /**
  * Pop the next job off of the queue, job should meet the JobInterface
  * requirements to be used by the worker.
  *
  * @param   string  $queue  an identifier for the queue
  *
  * @throws  Sntinel\QueueInterop\JobNotFoundException
  *
  * @return  Sntinel\QueueInterop\JobInterface
  */
 public function pop($queue = null) : JobInterface
 {
     $job = $this->pheanstalk->watchOnly($this->getQueue($queue))->reserve();
     if ($job instanceof PheanstalkJob) {
         return new BeanstalkdJob($this->getContainer(), $this->pheanstalk, $job, $queue);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function count()
 {
     $clientStats = $this->client->statsTube($this->name);
     return (int) $clientStats['current-jobs-ready'];
 }