Esempio n. 1
0
 /**
  * @param array $newJob array('worker'=>array(), ...)
  * @return bool|void
  * @throws \PHPQueue\Exception\Exception
  */
 public function addJob(array $newJob)
 {
     if (!isset($newJob['worker'])) {
         throw new \PHPQueue\Exception\WorkerNotFoundException("No workers declared.");
     }
     $this->resultLog->addInfo('Adding new job: ', $newJob);
     $workers = $newJob['worker'];
     unset($newJob['worker']);
     $formatted_data = array('worker' => $workers, 'data' => $newJob);
     $this->dataSource->add($formatted_data);
     return true;
 }