public final function execute(\GearmanJob $job) { $this->logger->addInfo(sprintf('Receiving job handle %s (%s)', $job->handle(), $job->unique())); try { $query = unserialize($job->workload()); $this->logger->addInfo('Workload unserialized'); if (!$query instanceof Query) { throw new RuntimeException('Expecting a Gloubster Query'); } $this->logger->addInfo('Query OK'); } catch (RuntimeException $e) { $this->logger->addError(sprintf('Error while getting the job : %s', $e->getMessage())); return; } try { $query->getDelivery($this->deliveryFactory, $this->configuration)->deliver($query->getUuid(), $this->processQuery($job, $query)); } catch (\Exception $e) { $this->logger->addError(sprintf('Error while processing : %s', $e->getMessage())); } }
/** * Get stream identifier. * * @return string */ public function getIdentifier() { return $this->_job->unique(); }