public function testDeleteMessage() { $queue = $this->queue->createQueue('test'); $queue->send(array(1, 2, 3)); foreach ($queue->receive() as $message) { $queue->deleteMessage($message); } $values = $this->rediska->getList('Zend_Queue_queue_test'); $this->assertEquals(array(), $values); }
/** * Create a queue. Returns the ID of the created queue (typically the URL). * It may take some time to create the queue. Check your vendor's * documentation for details. * * @param string $name * @param array $options * @return string Queue ID (typically URL) */ public function createQueue($name, $options = null) { try { $this->_queues[$name] = $this->_queue->createQueue($name, isset($options[Zend_Queue::TIMEOUT]) ? $options[Zend_Queue::TIMEOUT] : null); return $name; } catch (Zend_Queue_Exception $e) { throw new Zend_Cloud_QueueService_Exception('Error on queue creation: ' . $e->getMessage(), $e->getCode(), $e); } }
/** * @group ZF-7650 */ public function testReceiveWillRetrieveZeroItems() { $options = $this->getTestConfig(); $options['name'] = '/temp-queue/ZF7650'; $queue = new Zend_Queue('Db', $options); $queue2 = $queue->createQueue('queue'); $queue->send('My Test Message 1'); $queue->send('My Test Message 2'); $messages = $queue->receive(0); $this->assertEquals(0, count($messages)); }
public function test_ZF_7650() { // Zend_Queue_Adapter_Array $queue = new Zend_Queue('Array'); $queue2 = $queue->createQueue('queue'); $queue->send('My Test Message 1'); $queue->send('My Test Message 2'); $messages = $queue->receive(0); $this->assertEquals(0, count($messages)); // Zend_Queue_Adapter_Memcacheq $driverOptions = array(); if (defined('TESTS_ZEND_QUEUE_MEMCACHEQ_HOST')) { $driverOptions['host'] = TESTS_ZEND_QUEUE_MEMCACHEQ_HOST; } if (defined('TESTS_ZEND_QUEUE_MEMCACHEQ_PORT')) { $driverOptions['port'] = TESTS_ZEND_QUEUE_MEMCACHEQ_PORT; } $options = array('name' => 'ZF7650', 'driverOptions' => $driverOptions); $queue = new Zend_Queue('Memcacheq', $options); $queue2 = $queue->createQueue('queue'); $queue->send('My Test Message 1'); $queue->send('My Test Message 2'); $messages = $queue->receive(0); $this->assertEquals(0, count($messages)); // Zend_Queue_Adapter_Db $driverOptions = array(); if (defined('TESTS_ZEND_QUEUE_DB')) { require_once 'Zend/Json.php'; $driverOptions = Zend_Json::decode(TESTS_ZEND_QUEUE_DB); } $options = array('name' => '/temp-queue/ZF7650', 'options' => array(Zend_Db_Select::FOR_UPDATE => true), 'driverOptions' => $driverOptions); $queue = new Zend_Queue('Db', $options); $queue2 = $queue->createQueue('queue'); $queue->send('My Test Message 1'); $queue->send('My Test Message 2'); $messages = $queue->receive(0); $this->assertEquals(0, count($messages)); // Zend_Queue_Adapter_Activemq $driverOptions = array(); if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_HOST')) { $driverOptions['host'] = TESTS_ZEND_QUEUE_ACTIVEMQ_HOST; } if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_PORT')) { $driverOptions['port'] = TESTS_ZEND_QUEUE_ACTIVEMQ_PORT; } if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME')) { $driverOptions['scheme'] = TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME; } $options = array('driverOptions' => $driverOptions); $queue = new Zend_Queue('Activemq', $options); $queue2 = $queue->createQueue('queue'); $queue->send('My Test Message 1'); $queue->send('My Test Message 2'); $messages = $queue->receive(0); $this->assertEquals(0, count($messages)); }
/** * @group ZF-7650 */ public function testReceiveWillRetrieveZeroItems() { $options = array('driverOptions' => $this->getTestConfig()); $queue = new Zend_Queue('Activemq', $options); $queue2 = $queue->createQueue('queue'); $queue->send('My Test Message 1'); $queue->send('My Test Message 2'); $messages = $queue->receive(0); $this->assertEquals(0, count($messages)); }
/** * @group ZF-7650 */ public function testReceiveWillRetrieveZeroItems() { // Zend_Queue_Adapter_Array $queue = new Zend_Queue('Array'); $queue2 = $queue->createQueue('queue'); $queue->send('My Test Message 1'); $queue->send('My Test Message 2'); $messages = $queue->receive(0); $this->assertEquals(0, count($messages)); }