public final function execute($qOptions = array()) { // Tests should be run via run() not execute() $config = Mage::getConfig(); $q = new ZendJobQueue(); $jqOpts = $config->getModuleConfig('ZendServer_JobQueue'); if (!isset($jqOpts->jobqueue) && !isset($jqOpts->jobqueue->url)) { throw new ZendServer_JobQueue_Job_Exception('Missing the jobqueue configuration directive'); } $qOptions = array_merge(array('name' => get_class($this)), $qOptions); $ret = $q->createHttpJob($jqOpts->jobqueue->url, array('obj' => base64_encode(serialize($this))), $qOptions); return $ret; }
public function shareIssueAction() { $identity = $this->getEvent()->getParam('ZF\\MvcAuth\\Identity'); if ($identity instanceof \ZF\MvcAuth\Identity\AuthenticatedIdentity) { $userId = $identity->getAuthenticationIdentity()['user_id']; $user = $this->pdoAdapter->getUserDetails($userId); } else { //TODO : ApiProblem because no identity } $data = $this->bodyParams(); $id = $this->params()->fromRoute('id'); $data['issueId'] = $id; $data['sender'] = trim($user['first_name'] . ' ' . $user['last_name']); $jq = new \ZendJobQueue(); $url = $this->url()->fromRoute('application/default', array('controller' => 'mail', 'action' => 'send')); $jobId = $jq->createHttpJob($url, $data, array()); return compact('jobId'); }
public function reminderAction() { $eventId = $this->_getParam('event_id'); $event = SimpleCal_Model_Event::getInstanceById($eventId); foreach ($event->getInvitationEmails() as $email) { if ($email == '') { continue; } try { $reminderMod = new SimpleCal_Model_Email_Reminder($email); $reminderMod->assignToView('event', $event); $jobParams = $this->_helper->jqEmail($reminderMod); $queue = new ZendJobQueue(); $jobOptions = array('name' => self::JOB_REMINDER_PREFIX . $eventId, 'schedule_time' => $event->getReminderTime(), 'app_id' => self::JOB_APP_NAME); $queue->createHttpJob('/service/email', $jobParams, $jobOptions); } catch (SimpleCal_Exception $e) { //TODO: tell the User that he entered an invaild email address } } }
<?php $server = 'https://mwop.net'; $queue = new ZendJobQueue(); // First, remove any existing job schedules for our application foreach ($queue->getSchedulingRules() as $job) { if (0 !== strpos($job['script'], $server)) { // Job is not one we're interested in continue; } // Remove a previously scheduled job $queue->deleteSchedulingRule($job['id']); } // Add scheduled job for fetching comics $queue->createHttpJob($server . '/jobs/comics', [], ['name' => 'comics', 'persistent' => false, 'schedule' => '0 10 * * *']); // Add scheduled job for fetching github feed $queue->createHttpJob($server . '/jobs/github-feed', [], ['name' => 'github-feed', 'persistent' => false, 'schedule' => '5,20,35,40 * * * *']); // Schedule an immediate cache clear $queue->createHttpJob($server . '/jobs/clear-cache', [], ['name' => 'clear-cache', 'persistent' => false]);