本文整理汇总了PHP中Zend_Queue::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Queue::send方法的具体用法?PHP Zend_Queue::send怎么用?PHP Zend_Queue::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Queue
的用法示例。
在下文中一共展示了Zend_Queue::send方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: queueAction
/**
* queues an action
*
* @param string $_action
* @param mixed $_arg1
* @param mixed $_arg2
* ...
*
* @return string the job id
*/
public function queueAction()
{
$params = func_get_args();
$action = array_shift($params);
$message = array('action' => $action, 'account_id' => Tinebase_Core::getUser()->getId(), 'params' => $params);
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . " queueing action: '{$action}'");
}
return $this->_queue->send($message);
}
示例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));
}
示例3: 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;
}
示例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']);
}
}
示例5: 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));
}
示例6: 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));
}
示例7: 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));
}
示例8: 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));
}
示例9: saveMailLists
}
$sendresult[$key] = array($email, $receive_name);
$receiverinfo .= $email . "," . $receive_name . ";";
}
$maillogsidstr = '';
$totalnum = 0;
$arr = array();
$current_user_id = $current_user->id;
foreach ($sendresult as $rst) {
//生成日志ID
$maillogsid = $adb->getUniqueID("ec_maillogs");
$maillogsidstr .= $maillogsid . ",";
$to_email = $rst[0];
$receiver = $rst[1];
$message = "sjid={$sjid}&maillogsid={$maillogsid}&to_email={$to_email}&receiver={$receiver}&from_name={$from_name}&from_email={$from_email}&interval={$interval}&subject={$subject}&mailcontent={$mailcontent}&userid=" . $current_user_id;
$queue->send($message);
$totalnum++;
}
//保存事件
saveMailLists($sjid, $subject, $mailcontent, $maillogsidstr, $receiverinfo, $from_name, $from_email, $totalnum);
echo "SUCCESS";
die;
exit;
//list
function saveMailLists($sjid, $subject, $mailcontent, $maillogsidstr, $receiverinfo, $from_name, $from_email, $totalnum)
{
global $adb;
global $current_user;
$maillistname = "QFYJ" . date("Ymd") . "-" . $sjid;
$mailcontent = addslashes($mailcontent);
$sql = "insert into ec_maillists(maillistsid,maillistname,smcreatorid,createdtime,deleted,mailids,receiverinfo,from_name,from_email,subject,mailcontent,totalnum) values(" . $sjid . ",'" . $maillistname . "','" . $current_user->id . "','" . date("Y-m-d H:i:s") . "',0,'" . $maillogsidstr . "','" . $receiverinfo . "','" . $from_name . "','" . $from_email . "','" . $subject . "','" . $mailcontent . "','" . $totalnum . "')";
示例10: send
public function send($message)
{
parent::send((string) $message);
}
示例11: addTask
/**
* Add task to queue
*
* array (
* 'task_name' => '...',
* 'params' => array(),
* )
*
* @param array $task
* @return Enterprise_Queue_Model_Consumer
*/
public function addTask(array $task)
{
$this->_queue->send(Zend_Json::encode($task));
return $this;
}