Exemplo n.º 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);
     }
 }
Exemplo n.º 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());
 }