/** * Execute the job * * A job should finish itself after successful execution using the queue methods. * * @param QueueInterface $queue * @param Message $message The original message * @return bool TRUE if the job was executed successfully and the message should be finished */ public function execute(QueueInterface $queue, Message $message) { $jobExecuted = false; try { $jobExecuted = $this->jsonGeneratorService->generateJsonFile($this->entityName); } catch (\Exception $e) { $this->logger->logException($e); } return $jobExecuted; }
/** * Execute the job * * A job should finish itself after successful execution using the queue methods. * * @param QueueInterface $queue * @param Message $message The original message * @return bool TRUE if the job was executed successfully and the message should be finished */ public function execute(QueueInterface $queue, Message $message) { // only one at the time to avoid stacking of requests if ($queue->count() > 0) { return true; } $solrExporter = new DataExportController(); $solrExporter->injectSettings($this->settings); $solrExporter->initializeAction(); try { $jobExecuted = $solrExporter->mysql2solrExportAction(); } catch (\Exception $e) { $this->logger->logException($e); $jobExecuted = false; } return $jobExecuted; }
public function initializeAction() { $this->configuration = ['endpoint' => ['localhost' => ['host' => $this->settings['solr']['host'], 'port' => $this->settings['solr']['port'], 'path' => $this->settings['solr']['path'], 'core' => $this->settings['solr']['core'], 'timeout' => $this->settings['solr']['timeout']]]]; if (!$this->logger) { $log = new LoggerFactory(); $this->logger = $log->create('GermaniaSacra', 'TYPO3\\Flow\\Log\\Logger', '\\TYPO3\\Flow\\Log\\Backend\\FileBackend', ['logFileUrl' => FLOW_PATH_DATA . 'Logs/GermaniaSacra/Mysql2Solr.log', 'createParentDirectories' => true]); } $this->client = new \Solarium\Client($this->configuration); $this->client->setAdapter('Solarium\\Core\\Client\\Adapter\\Curl'); $personenFile = FLOW_PATH_DATA . 'Persistent/GermaniaSacra/personen.json'; $http = new \Guzzle\Http\Client(); try { $personenData = $http->get(self::PERSONEN_URL)->send()->getBody(); file_put_contents($personenFile, $personenData); } catch (\Exception $e) { $this->logger->logException($e); } $this->personen = json_decode(file_get_contents($personenFile), true); $this->dataImport = new \Subugoe\GermaniaSacra\Controller\DataImportController(); }