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); } }
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()); }
/** * 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()))); }