本文整理汇总了PHP中Zend_Queue::createQueue方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Queue::createQueue方法的具体用法?PHP Zend_Queue::createQueue怎么用?PHP Zend_Queue::createQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Queue
的用法示例。
在下文中一共展示了Zend_Queue::createQueue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDeleteMessage
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);
}
示例2: createQueue
/**
* 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);
}
}
示例3: testReceiveWillRetrieveZeroItems
/**
* @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));
}
示例4: test_ZF_7650
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));
}
示例5: testReceiveWillRetrieveZeroItems
/**
* @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));
}
示例6: testReceiveWillRetrieveZeroItems
/**
* @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));
}