Пример #1
0
 public function onReceive(QueueReceiveEvent $event)
 {
     try {
         # save the job onto the queue
         $result = $this->gateway->insertQuery()->start()->addColumn('job_id', $event->getStorage()->getJobId())->addColumn('state_id', $event->getStorage()->getState())->addColumn('dte_add', $event->getStorage()->getDateAdded())->addColumn('retry_count', $event->getStorage()->getRetryLeft())->addColumn('job_data', $event->getStorage()->getJobData())->end()->insert();
         # did we lock some rows
         $event->setResult($result);
     } catch (DBALGatewayException $e) {
         throw new LaterJobException($e->getMessage(), 0, $e);
     }
 }
Пример #2
0
 public function testQueueReceiveEvent()
 {
     $storage = $this->getMock('LaterJob\\Model\\Queue\\Storage');
     $result = true;
     $receive = new QueueReceiveEvent($storage);
     $receive->setResult($result);
     $this->assertEquals($storage, $receive->getStorage());
     $this->assertEquals($result, $receive->getResult());
 }
Пример #3
0
 /**
  *  Log events that occur from queue
  *
  *  @access public
  *  @param QueueReceiveEvent $event 
  */
 public function logQueueReceiveEvent(QueueReceiveEvent $event)
 {
     $this->log->info('QueueReceiveEvent:: Queue received job', array('job_id' => $event->getStorage()->getJobId()));
 }
 /**
  *  Log events that occur from queue
  *
  *  @access public
  *  @param QueueReceiveEvent $event 
  */
 public function logQueueReceiveEvent(QueueReceiveEvent $event)
 {
     $this->output->writeln('QueueReceiveEvent:: Queue received job ' . json_encode(array('job_id' => $event->getStorage()->getJobId())));
 }