/** * @param BatchJob $dbBatchJob * @return bool true if the consumer should handle the event */ public function shouldConsumeJobStatusEvent(BatchJob $dbBatchJob) { $jobType = ScheduledTaskPlugin::getBatchJobTypeCoreValue(ScheduledTaskBatchType::SCHEDULED_TASK); if ($dbBatchJob->getJobType() == $jobType) { return true; } return false; }
/** * @param ScheduledTaskProfile $scheduledTaskProfile * @param kScheduledTaskJobData $jobData * @return BatchJob */ protected function createScheduledTaskJob(ScheduledTaskProfile $scheduledTaskProfile, kScheduledTaskJobData $jobData) { $scheduledTaskProfileId = $scheduledTaskProfile->getId(); $jobType = ScheduledTaskPlugin::getBatchJobTypeCoreValue(ScheduledTaskBatchType::SCHEDULED_TASK); $objectType = ScheduledTaskPlugin::getBatchJobObjectTypeCoreValue(ScheduledTaskBatchJobObjectType::SCHEDULED_TASK_PROFILE); KalturaLog::log("Creating scheduled task dry run job for profile [" . $scheduledTaskProfileId . "]"); $batchJob = new BatchJob(); $batchJob->setPartnerId($scheduledTaskProfile->getPartnerId()); $batchJob->setObjectId($scheduledTaskProfileId); $batchJob->setObjectType($objectType); $batchJob->setStatus(BatchJob::BATCHJOB_STATUS_PENDING); $batchJob = kJobsManager::addJob($batchJob, $jobData, $jobType); return $batchJob; }