Exemplo n.º 1
0
 /**
  * @param \DelayedJobs\DelayedJob\Job $job Job to publish
  * @return void
  */
 public function publishJob(Job $job)
 {
     $delay = $job->getRunAt()->isFuture() ? Time::now()->diffInSeconds($job->getRunAt(), false) * 1000 : 0;
     //Invert the priority because Rabbit does things differently
     $jobPriority = $this->_manager->config('maximum.priority') - $job->getPriority();
     $jobData = ['priority' => $jobPriority > 0 ? $jobPriority : 0, 'delay' => $delay, 'payload' => ['id' => $job->getId()]];
     $this->getDriver()->publishJob($jobData);
 }
Exemplo n.º 2
0
 public function getChannel()
 {
     if ($this->_channel) {
         return $this->_channel;
     }
     $this->_channel = $this->getConnection()->channel();
     $this->declareExchange();
     $this->declareQueue($this->_manager->config('maximum.priority'));
     $this->bind();
     return $this->_channel;
 }