/** * {@inheritdoc} */ public function pop($queue, $timeout = 0) { $job = $this->iron->getMessage($queue, $timeout); if ($job instanceof \stdClass) { return new $this->managerClass($queue, $job, $this); } throw new QueueEmptyException($queue); }
public function fetchJob($timeout = null) { $ironMqMessage = $this->ironMQ->getMessage($this->queue_name); if (!$ironMqMessage) { return null; } $job = new IronMQQueueJob($ironMqMessage); $job->setQueue($this); return $job; }
<?php include "phar://iron_mq.phar"; $ironmq = new IronMQ('config.ini'); $ironmq->debug_enabled = true; $ironmq->ssl_verifypeer = false; $res = $ironmq->postMessage("test_queue", array("body" => "Test Message")); print_r($res); sleep(2); print "Getting message.."; $message = $ironmq->getMessage("test_queue"); print_r($message);
var_dump($res); $msg = $ironmq->reserveMessage($q_name); var_dump($msg); $reservation_id = $msg->reservation_id; for ($i = 0; $i < 3; $i++) { sleep(5); $res = $ironmq->touchMessage($q_name, $msg->id, $reservation_id); $reservation_id = $res->reservation_id; var_dump($res); } exit; $res = $ironmq->clearQueue("test_queue"); var_dump($res); $ironmq->postMessage("test_queue", "Test Message 2"); $ironmq->postMessage("test_queue", "Test Message 3"); $res = $ironmq->getMessage("test_queue"); var_dump($res); $res = $ironmq->getMessage("test_queue"); var_dump($res); $ironmq->postMessage("test_queue", "Test Message 4"); $ironmq->postMessage("test_queue", "Test Message 5"); $ironmq->postMessage("test_queue", "Test Message 6"); $res = $ironmq->reserveMessages("test_queue", 2); var_dump($res); $ironmq->clearQueue("test_queue"); $ironmq->postMessage("test_queue", "Test Message 5"); $ironmq->postMessage("test_queue", "Test Message 6"); $res = $ironmq->peekMessages("test_queue", 2); var_dump($res); $res = $ironmq->peekMessages("test_queue", 2); var_dump($res);