SAMConnection::peekAll

(PECL sam >= 0.2.0)

SAMConnection::peekAll Read one or more messages from a queue without removing it from the queue

说明

SAMConnection::peekAll ( string $target [, array $properties ] ) : array

参数

target

The identity of the queue from which messages should be peeked.

properties

An optional associative array of properties describing other parameters to control the peek operation.

Property name Possible values
SAM_CORRELID This is the target correlation id string of messages to be peeked. This would typically have been returned by a "send" request.
SAM_MESSAGEID This is the message id string of a message which is to be peeked.

返回值

This method returns an array of SAMMessage objects or FALSE if an error occurs.

范例

Example #1 Retrieve all messages in a queue without removing them

<?php
$msgArray 
$conn->peekAll('queue://receive/test');
if (
$msgArray) {
   foreach ( 
$msgArray as $key => $msg) {
       echo 
"Message $key: body = $msg->body\n";
   }
} else {
   echo 
"PeekAll failed ($conn->errno$conn->error";
}
?>

Example #2 Retrieve all messages from a queue with a matching correlation id

<?php

   $msgArray 
$conn->peekAll('queue://receive/test', array(SAM_CORRELID => $correlId ));
   if (
$msgArray) {

      foreach ( 
$msgArray as $key => $msg) {
            echo 
"Message $key: body = $msg->body\n";
         }
   } else {
      echo 
"PeekAll failed ($conn->errno$conn->error";
   }

?>

相关文章
php gettext 函数 specify the character encoding in which the messages from the domain message catalog will be returnedphp cubrid 过时的别名和函数 read data from a glo instance and save it in a filephp cubrid 过时的别名和函数 read data from glo and send it to std outputphp eio 函数 read from a file descriptor at given offsetphp expect 函数 waits until the output from a process matches one of the patterns a specified time period has passed or an eof is seenphp fdf 函数 read a fdf document from a stringphp firebird/interbase 函数 roll back a transaction without closing itphp imap 函数 read the list of mailboxes returning detailed information on each onephp maxdb 函数 check if there any more query results from a multi queryphp 多字节字符串 函数 convert kana one from another zen kaku han kaku and more php ncurses 函数 read a character from keyboardphp ncurses 函数 remove panel from the stack making it invisiblephp newt 函数 replaces the current help line with the one from the stackphp sqlite 函数 encode binary data before returning it from an udfphp sam 函数 disconnects from a messaging serverphp sam 函数 read a message from a queue without removing it from the queuephp sam 函数 read one or more messages from a queue without removing it from the queuephp sam 函数 receive a message from a queue or subscriptionphp sam 函数 remove a message from a queuephp sdo das xml 函数 creates an xml document object from scratch without the need to load a document from a file or string
关注编程学问公众号