예제 #1
0
 public function getSchedule()
 {
     if (is_string($this->data['schedule'])) {
         $rqlParser = new RqlParser();
         return $rqlParser->decode($this->data['schedule']);
     }
     return $this->data['schedule'];
 }
예제 #2
0
 /**
  * Tick callback which called from Ticker
  *
  * @param $tickId
  * @param $step
  * @throws SchedulerException
  * @throws \zaboy\scheduler\Callback\CallbackException
  */
 public function processTick($tickId, $step)
 {
     $rqlParser = new RqlParser();
     foreach ($this->filters as $filter) {
         // Parses rql-query expression
         $rqlQueryObject = $rqlParser->decode($filter['rql']);
         // Step value determined in Timeline DataStore
         if ($this->timelineDs->determineStep($rqlQueryObject) < $step) {
             throw new SchedulerException("The step determined from query to timeline DataStore is less than step given from Ticker");
         }
         // Adds time limits and executes query to timeline
         $rqlQueryObject = $this->addTickLimit($rqlQueryObject, $tickId, $step);
         $matches = $this->timelineDs->query($rqlQueryObject);
         // If mathces were found runs their callbacks
         if (count($matches)) {
             /** @var CallbackInterface $instance */
             $instance = $this->callbackManager->get($filter['callback']);
             $instance->call(['tick_id' => $tickId, 'step' => $step]);
         }
     }
 }