Exemple #1
0
 /**
  * @return boolean
  */
 protected function runLoop()
 {
     while (true) {
         $this->output->writeln("");
         $this->output->writeln("Waiting for jobs...");
         $job = $this->pheanstalk->reserve();
         $this->output->writeln(sprintf("Received job %s.", $job->getId()));
         if ($this->runJob($job)) {
             $this->output->writeln(sprintf("Delete %s.", $job->getId()));
             $this->pheanstalk->delete($job);
         } else {
             // no handler exists, re-queue for in 60 seconds, maybe restart happend.
             $this->output->writeln(sprintf("Release %s.", $job->getId()));
             $this->pheanstalk->release($job, 100, 60);
         }
     }
 }