Exemplo n.º 1
0
 private function handleException(WorkerException $exception)
 {
     $workerData = new WorkerData();
     $workerData->id = $this->_worker->getId();
     $workerData->status = new WorkerStatusEnum(WorkerStatusEnum::FAILED);
     $workerData->endDateTime = new DateTime();
     $this->_workerRepository->updateWorkerStatus($workerData);
     $event = new WorkerEvent();
     $event->status = new WorkerEventStatusEnum(WorkerEventStatusEnum::EVENT_ON_FAILED);
     $event->data = $exception;
     $this->trigger(self::EVENT_WORKER_STATUS, $event);
     $message = "worker {$workerData->id} failed, Exception \"{$exception->getMessage()}\"";
     do {
         $internalException = $exception->getInternalException();
         if ($internalException !== null) {
             $message .= ", \t\nInternal exception: \"{$internalException->getMessage()}\" :";
             $message .= "\t\t\n Trace:" . $internalException->getTraceAsString();
         }
         $exception = $internalException;
     } while ($internalException !== null && $internalException instanceof InternalExceptionBase);
     $this->log($message, Logger::LEVEL_ERROR);
 }
Exemplo n.º 2
0
 function getWorker($workerId)
 {
     return $this->_workerRepository->getById($workerId);
 }