Example #1
0
 /**
  * Crea un Job per un customer
  * @param $data
  * @return JobModel
  */
 public function createJob($data)
 {
     if (empty($data)) {
         throw new \Exception("Error in parsing data");
     }
     $this->parseInputData($data);
     $jobModel = $this->dbTrans(function () {
         $input = $this->jobEntity->getInput();
         $callback = $this->jobEntity->getCallback();
         $output = $this->jobEntity->getOutput();
         $customer = Session::getUsername();
         $job = JobModel::create($customer)->setSource($input['url'], $input['fileName'], @$input['md5Hash'], @$input['headers'], @$input['verb'], @$input['keyRegexp'], @$input['tokenRegexp'])->setCallback($input['url'], @$input['headers'], @$input['additionalInfo'], @$input['verb'], @$input['keyRegexp'], @$input['tokenRegexp']);
         foreach ($output as $out) {
             $task = TaskModel::create($job, $out['format'], $out['resolution'], $out['extra']);
         }
         return $job;
     });
     return $jobModel;
 }
 /**
  * Esegue il QueueJob
  *
  * @param array $params
  * @param LoggerInterface $logger (optional)
  * @return bool
  */
 public function run()
 {
     $jobModel = JobModel::where('id', '=', $this->getParam('jobId'))->firstOrFail();
     $service = new JobService();
     $service->setDao($jobModel)->resolveSource(false);
 }