當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Queue類代碼示例

本文整理匯總了PHP中Zend_Queue的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Queue類的具體用法?PHP Zend_Queue怎麽用?PHP Zend_Queue使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Zend_Queue類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
 }
開發者ID:r-kovalenko,項目名稱:Rediska,代碼行數:10,代碼來源:QueueTest.php

示例2: send

 public function send($template)
 {
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
     $queue = new Zend_Queue('Activemq', $config->queue->activemq->toArray());
     $data = array();
     $data['RecipientEmail'] = $template->getRecipientEmail();
     $data['RecipientName'] = $template->getRecipientName();
     $data['From'] = $template->getFrom();
     $data['Subject'] = $template->getSubject();
     $data['BodyText'] = $template->getBodyText();
     $data['BodyHtml'] = $template->getBodyHtml();
     $data['SenderEmail'] = $template->getSenderEmail();
     $data['SenderName'] = $template->getSenderName();
     $message = $queue->send(serialize($data));
 }
開發者ID:revoleers,項目名稱:rewardimizer-server,代碼行數:15,代碼來源:Mail.php

示例3: listQueues

 /**
  * List all queues.
  *
  * @param  array $options
  * @return array Queue IDs
  */
 public function listQueues($options = null)
 {
     try {
         return $this->_queue->getQueues();
     } catch (Zend_Queue_Exception $e) {
         throw new Zend_Cloud_QueueService_Exception('Error on listing queues: ' . $e->getMessage(), $e->getCode(), $e);
     }
 }
開發者ID:alefernie,項目名稱:intranet,代碼行數:14,代碼來源:ZendQueue.php

示例4: start

 public function start(Zend_Queue $q)
 {
     Loader::library('database_indexed_search');
     $this->is = new IndexedSearch();
     Loader::model('attribute/categories/collection');
     Loader::model('attribute/categories/file');
     Loader::model('attribute/categories/user');
     $attributes = CollectionAttributeKey::getList();
     $attributes = array_merge($attributes, FileAttributeKey::getList());
     $attributes = array_merge($attributes, UserAttributeKey::getList());
     foreach ($attributes as $ak) {
         $ak->updateSearchIndex();
     }
     $db = Loader::db();
     $db->Execute('truncate table PageSearchIndex');
     $r = $db->Execute('select Pages.cID from Pages left join CollectionSearchIndexAttributes csia on Pages.cID = csia.cID where (ak_exclude_search_index is null or ak_exclude_search_index = 0) and cIsActive = 1');
     while ($row = $r->FetchRow()) {
         $q->send($row['cID']);
     }
 }
開發者ID:ojalehto,項目名稱:concrete5-legacy,代碼行數:20,代碼來源:index_search_all.php

示例5: send

 /**
  * Send a message to the queue
  *
  * @param  Custom_Message|Custom_Messages $message message
  * @return $this
  * @throws Zend_Queue_Exception
  */
 public function send($message)
 {
     if (!($message instanceof Custom_Message || $message instanceof Custom_Messages)) {
         /**
          * @see Zend_Queue_Exception
          */
         require_once 'Zend/Queue/Exception.php';
         throw new Zend_Queue_Exception('$message must be an instance of Custom_Message or Custom_Messages');
     }
     if ($message instanceof Custom_Message) {
         $response = parent::send($message->__toString());
     } else {
         foreach ($message as $i => $one) {
             $response = parent::send($one->__toString());
         }
     }
     return $this;
 }
開發者ID:ThorstenSuckow,項目名稱:conjoon,代碼行數:25,代碼來源:Queue.php

示例6: count

 /**
  * Return the approximate number of messages in the queue
  *
  * @param  Zend_Queue $queue
  * @return integer
  * @throws Zend_Queue_Exception (not supported)
  */
 public function count(Zend_Queue $queue = null)
 {
     if ($queue !== null) {
         return $queue->count();
     }
     return false;
 }
開發者ID:stunti,項目名稱:Stunti_Cache_Backend_Mongo,代碼行數:14,代碼來源:Mongo.php

示例7: 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));
 }
開發者ID:omusico,項目名稱:logica,代碼行數:14,代碼來源:DbTest.php

示例8: 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));
 }
開發者ID:travisj,項目名稱:zf,代碼行數:56,代碼來源:ZF-7650Test.php

示例9: array

<?php

require_once 'config.inc.php';
require_once 'include/utils/utils.php';
require_once 'include/Zend/Queue.php';
global $adb, $current_user;
global $currentModule;
global $dbconfig;
$options = array('name' => 'queue1', 'driverOptions' => array('host' => $dbconfig['db_server'], 'port' => substr($dbconfig['db_port'], 1), 'username' => $dbconfig['db_username'], 'password' => $dbconfig['db_password'], 'dbname' => $dbconfig['db_name'], 'type' => 'pdo_mysql'));
$queue = new Zend_Queue('Db', $options);
//$queue->send('postdata=1&name=1');
$nowdate = date("Y-m-d");
$nowdatetime = date("Y-m-d H:i:s");
$sjid = $_REQUEST["sjid"];
$subject = $_REQUEST["subject"];
$mailcontent = $_REQUEST["mailcontent"];
$mailcontent = stripslashes($mailcontent);
//$mailfrom = $_REQUEST["mailfrom"];
//$mailfrom_arr = explode("(",$mailfrom);
//$from_email = $mailfrom_arr[0];
//$from_name  = substr($mailfrom_arr[1],0,-1);
//$interval  = substr($mailfrom_arr[2],0,-2);
$from_name = $_REQUEST["from_name"];
$from_email = $_REQUEST["from_email"];
$interval = $_REQUEST["interval"];
$receiveaccountinfo = $_REQUEST["receiveaccountinfo"];
//$receiveaccountinfo =  str_replace("##",'&',$receiveaccountinfo);
//$receiveaccountarr = explode("\n",$receiveaccountinfo);
$receiveaccountarr = explode("**", $receiveaccountinfo);
//var_dump($receiveaccountarr);
//exit;
開發者ID:Pengzw,項目名稱:c3crm,代碼行數:31,代碼來源:SendMailToAll.php

示例10: _subscribe

 /**
  * Subscribes the client to the queue.
  *
  * @param  Zend_Queue $queue
  * @return void
  */
 protected function _subscribe(Zend_Queue $queue)
 {
     $frame = $this->_client->createFrame();
     $frame->setCommand('SUBSCRIBE');
     $frame->setHeader('destination', $queue->getName());
     $frame->setHeader('ack', 'client');
     $this->_client->send($frame);
     $this->_subscribed[$queue->getName()] = true;
 }
開發者ID:siite,項目名稱:choose-sa-cloud,代碼行數:15,代碼來源:Activemq.php

示例11: 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));
 }
開發者ID:omusico,項目名稱:logica,代碼行數:13,代碼來源:ActivemqTest.php

示例12: 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));
 }
開發者ID:omusico,項目名稱:logica,代碼行數:13,代碼來源:ArrayTest.php

示例13: define

define('IN_CRMONE', true);
$root_directory = dirname(__FILE__) . "/";
require $root_directory . 'config.php';
require_once $root_directory . 'include/utils/utils.php';
require_once $root_directory . 'include/utils/CommonUtils.php';
require_once $root_directory . 'include/database/PearDatabase.php';
require_once $root_directory . 'include/logging.php';
require_once $root_directory . 'modules/Users/Users.php';
require_once $root_directory . 'include/utils/clean_incoming_data.php';
require_once $root_directory . 'user_privileges/seqprefix_config.php';
require_once $root_directory . 'include/Zend/Queue.php';
global $adb;
global $site_URL;
global $dbconfig;
$options = array('name' => 'queue1', 'driverOptions' => array('host' => $dbconfig['db_server'], 'port' => substr($dbconfig['db_port'], 1), 'username' => $dbconfig['db_username'], 'password' => $dbconfig['db_password'], 'dbname' => $dbconfig['db_name'], 'type' => 'pdo_mysql'));
$queue = new Zend_Queue('Db', $options);
//一分鍾發送25條
$messages = $queue->receive(100);
foreach ($messages as $i => $message) {
    //參數字符串
    $postdata = $message->body;
    $posts = explode("&", $postdata);
    //sjid
    $sjid_arr = explode("=", $posts[0]);
    $sjid = $sjid_arr['1'];
    //maillogsid
    $maillogsid_arr = explode("=", $posts[1]);
    $maillogsid = $maillogsid_arr['1'];
    //判斷是否已經發送過了
    $mailflag = checkMaillog($maillogsid);
    if (!$mailflag) {
開發者ID:Pengzw,項目名稱:c3crm,代碼行數:31,代碼來源:dosendmail.php

示例14: testConstruct

 /**
  * Constructor
  *
  * @param string|Zend_Queue_Adapter_Abstract $adapter
  * @param array  $config
  */
 public function testConstruct()
 {
     // Test Zend_Config
     $config = array('name' => 'queue1', 'params' => array(), 'adapter' => 'array');
     $zend_config = new Zend_Config($config);
     $obj = new Zend_Queue($config);
     $this->assertTrue($obj instanceof Zend_Queue);
     // test logger
     $this->assertTrue($obj->getLogger() instanceof Zend_Log);
     $obj = new Zend_Queue($zend_config);
     $this->assertTrue($obj instanceof Zend_Queue);
     try {
         $obj = new Zend_Queue('ops');
         $this->fail('Zend_Queue cannot accept a string');
     } catch (Exception $e) {
         $this->assertTrue(true);
     }
 }
開發者ID:travisj,項目名稱:zf,代碼行數:24,代碼來源:QueueTest.php

示例15: work

 /**
  * Process all pending tasks
  */
 public function work()
 {
     while (count($task = $this->_queue->receive()) > 0) {
         try {
             $taskData = $task->toArray();
             $this->getWorker()->execute($taskData[0]);
         } catch (Exception $e) {
             $this->_logger->logException($e);
         }
     }
 }
開發者ID:xiaoguizhidao,項目名稱:autotech_design,代碼行數:14,代碼來源:Receiver.php


注:本文中的Zend_Queue類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。