/** * Activates the channel processing job * * @param string $json * @return string $json */ public function RunService($json) { //Setup the logger $logger = \Swiftriver\Core\Setup::GetLogger(); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [Method invoked]", \PEAR_LOG_INFO); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [START: Parsing the JSON input]", \PEAR_LOG_DEBUG); //Parse the JSON input $channel = parent::ParseJSONToChannel($json); if (!isset($channel)) { $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [ERROR: Method ParseIncommingJSON returned null]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [ERROR: Registering new processing job with Core]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("There were errors in you JSON. Please review the API documentation and try again."); } $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [END: Parsing the JSON input]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [START: Constructing Repository]", \PEAR_LOG_DEBUG); //Construct a new repository $repository = new \Swiftriver\Core\DAL\Repositories\ChannelProcessingJobRepository(); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [END: Constructing Repository]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [START: Activatin Processing Job]", \PEAR_LOG_DEBUG); //Activate the channel processing job $repository->ActivateChannelProcessingJob($channel); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [END: Activating Processing Job]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ActivateChannelProcessingJob::RunService [Method finished]", \PEAR_LOG_INFO); //return an OK messagae return parent::FormatMessage("OK"); }
/** * Adds the pre processing job to the DAL * * @param string $json * @return string $json */ public function RunWorkflow($json, $key) { //Setup the logger $logger = \Swiftriver\Core\Setup::GetLogger(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [Method invoked]", \PEAR_LOG_INFO); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [START: Parsing the JSON input]", \PEAR_LOG_DEBUG); try { //Parse the JSON input $channel = parent::ParseJSONToChannel($json); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } if (!isset($channel)) { $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [ERROR: Method ParseIncommingJSON returned null]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [ERROR: Registering new processing job with Core]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("There were errors in you JSON. Please review the API documentation and try again."); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [END: Parsing the JSON input]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [START: Constructing Repository]", \PEAR_LOG_DEBUG); try { //Construct a new repository $repository = new \Swiftriver\Core\DAL\Repositories\ChannelProcessingJobRepository(); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [END: Constructing Repository]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [START: Saving Processing Job]", \PEAR_LOG_DEBUG); try { //Add the channel processign job to the repository $repository->SaveChannelProgessingJob($channel); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [END: Saving Processing Job]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RegisterNewProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); //return an OK messagae return parent::FormatMessage("OK"); }
/** * List all Channel Processing Jobs in the Data Store * * @param string $json * @return string $json */ public function RunWorkflow($key) { //Setup the logger $logger = \Swiftriver\Core\Setup::GetLogger(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [Method invoked]", \PEAR_LOG_INFO); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [START: Constructing Repository]", \PEAR_LOG_DEBUG); try { //Construct a new repository $repository = new \Swiftriver\Core\DAL\Repositories\ChannelProcessingJobRepository(); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [END: Constructing Repository]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [START: Listing all processing jobs]", \PEAR_LOG_DEBUG); try { //Get all the channel processing jobs $channels = $repository->ListAllChannelProcessingJobs(); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [END: Listing all processing jobs]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [START: Parsing channel processing jobs to JSON]", \PEAR_LOG_DEBUG); try { //Parse the JSON input $json = parent::ParseChannelsToJSON($channels); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [END: Parsing channel processing jobs to JSON]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::ListAllChannelProcessingJobs::RunWorkflow [Method finished]", \PEAR_LOG_INFO); //return the channels as JSON return $json; }
/** * List all Channel Processing Jobs in the Data Store * * @param string $json * @return string $json */ public function RunService() { //Setup the logger $logger = \Swiftriver\Core\Setup::GetLogger(); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ListAllChannelProcessingJobs::RunService [Method invoked]", \PEAR_LOG_INFO); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ListAllChannelProcessingJobs::RunService [START: Constructing Repository]", \PEAR_LOG_DEBUG); //Construct a new repository $repository = new \Swiftriver\Core\DAL\Repositories\ChannelProcessingJobRepository(); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ListAllChannelProcessingJobs::RunService [END: Constructing Repository]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ListAllChannelProcessingJobs::RunService [START: Listing all processing jobs]", \PEAR_LOG_DEBUG); //Get all the channel processing jobs $channels = $repository->ListAllChannelProcessingJobs(); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ListAllChannelProcessingJobs::RunService [END: Listing all processing jobs]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ListAllChannelProcessingJobs::RunService [START: Parsing channel processing jobs to JSON]", \PEAR_LOG_DEBUG); //Parse the JSON input $json = parent::ParseChannelsToJSON($channels); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ListAllChannelProcessingJobs::RunService [END: Parsing channel processing jobs to JSON]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::ListAllChannelProcessingJobs::RunService [Method finished]", \PEAR_LOG_INFO); //return the channels as JSON return $json; }
/** * Selects the next due processing job and runs it through the core * * @return string $json */ public function RunService() { //Setup the logger $logger = \Swiftriver\Core\Setup::GetLogger(); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [Method invoked]", \PEAR_LOG_INFO); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [START: Constructing Repository]", \PEAR_LOG_DEBUG); //Construct a new repository $channelRepository = new \Swiftriver\Core\DAL\Repositories\ChannelProcessingJobRepository(); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [END: Constructing Repository]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [START: Fetching next processing Job]", \PEAR_LOG_DEBUG); //Get the next due channel processign job $channel = $channelRepository->SelectNextDueChannelProcessingJob(); if ($channel == null) { $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [INFO: No processing jobs due]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [END: Fetching next processing Job]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [Method finished]", \PEAR_LOG_INFO); return parent::FormatMessage("OK"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [END: Fetching next processing Job]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [START: Get and parse content]", \PEAR_LOG_DEBUG); $SiSPS = new \Swiftriver\Core\Modules\SiSPS\SwiftriverSourceParsingService(); $rawContent = $SiSPS->FetchContentFromChannel($channel); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [END: Get and parse content]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [START: Running core processing]", \PEAR_LOG_DEBUG); $preProcessor = new \Swiftriver\Core\PreProcessing\PreProcessor(); $processedContent = $preProcessor->PreProcessContent($rawContent); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [END: Parsing channel processing jobs to JSON]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [START: Save content to the data store]", \PEAR_LOG_DEBUG); $contentRepository = new \Swiftriver\Core\DAL\Repositories\ContentRepository(); $contentRepository->SaveContent($processedContent); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [END: Save content to the data store]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [START: Mark channel processing job as complete]", \PEAR_LOG_DEBUG); $channelRepository->MarkChannelProcessingJobAsComplete($channel); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [END: Mark channel processing job as complete]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobClasses::RunNextProcessingJob::RunService [Method finished]", \PEAR_LOG_INFO); return parent::FormatMessage("OK"); }
/** * Deactivates the channel processing job * * @param string $json * @return string $json */ public function RunWorkflow($json, $key) { //Setup the logger $logger = \Swiftriver\Core\Setup::GetLogger(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [Method invoked]", \PEAR_LOG_INFO); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [START: Parsing the JSON input]", \PEAR_LOG_DEBUG); //try to parse the id from the JSON try { //get the ID from the JSON $id = parent::ParseJSONToChannelId($json); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [END: Parsing the JSON input]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [START: Constructing Repository]", \PEAR_LOG_DEBUG); try { //Construct a new repository $repository = new \Swiftriver\Core\DAL\Repositories\ChannelProcessingJobRepository(); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [END: Constructing Repository]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [START: Getting the channel from the repository]", \PEAR_LOG_DEBUG); try { //Get the channel from the repo $channel = $repository->GetChannelProcessingJobById($id); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [END: Getting the channel from the repository]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [START: Marking channel processing job as inactive and saving to the repository]", \PEAR_LOG_DEBUG); try { //set the active flag to false $channel->active = false; //save the channel back to the repo $repository->SaveChannelProgessingJob($channel); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [END: Marking channel processing job as inactive and saving to the repository]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::DeactivateChannelProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); //return an OK messagae return parent::FormatMessage("OK"); }
/** * Selects the next due processing job and runs it through the core * * @return string $json */ public function RunWorkflow($key) { //Setup the logger $logger = \Swiftriver\Core\Setup::GetLogger(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [Method invoked]", \PEAR_LOG_INFO); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [START: Setting time out]", \PEAR_LOG_DEBUG); set_time_limit(300); $timeout = ini_get('max_execution_time'); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [END: Setting time out to {$timeout}]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [START: Constructing Repository]", \PEAR_LOG_DEBUG); try { //Construct a new repository $channelRepository = new \Swiftriver\Core\DAL\Repositories\ChannelProcessingJobRepository(); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [END: Constructing Repository]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [START: Fetching next processing Job]", \PEAR_LOG_DEBUG); try { //Get the next due channel processign job $channel = $channelRepository->SelectNextDueChannelProcessingJob(time()); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } if ($channel == null) { $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [INFO: No processing jobs due]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [END: Fetching next processing Job]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatMessage("OK"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [END: Fetching next processing Job]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [START: Get and parse content]", \PEAR_LOG_DEBUG); try { $SiSPS = new \Swiftriver\Core\Modules\SiSPS\SwiftriverSourceParsingService(); $rawContent = $SiSPS->FetchContentFromChannel($channel); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } if (isset($rawContent) && is_array($rawContent) && count($rawContent) > 0) { $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [END: Get and parse content]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [START: Running core processing]", \PEAR_LOG_DEBUG); try { $preProcessor = new \Swiftriver\Core\PreProcessing\PreProcessor(); $processedContent = $preProcessor->PreProcessContent($rawContent); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [END: Running core processing]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [START: Save content to the data store]", \PEAR_LOG_DEBUG); try { $contentRepository = new \Swiftriver\Core\DAL\Repositories\ContentRepository(); $contentRepository->SaveContent($processedContent); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [END: Save content to the data store]", \PEAR_LOG_DEBUG); } else { $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [END: Get and parse content]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [No content found.]", \PEAR_LOG_DEBUG); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [START: Mark channel processing job as complete]", \PEAR_LOG_DEBUG); try { $channelRepository->MarkChannelProcessingJobAsComplete($channel); } catch (\Exception $e) { //get the exception message $message = $e->getMessage(); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [{$message}]", \PEAR_LOG_ERR); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatErrorMessage("An exception was thrown: {$message}"); } $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [END: Mark channel processing job as complete]", \PEAR_LOG_DEBUG); $logger->log("Core::ServiceAPI::ChannelProcessingJobs::RunNextProcessingJob::RunWorkflow [Method finished]", \PEAR_LOG_INFO); return parent::FormatMessage("OK"); }