Beispiel #1
0
 $msg->body = 'This is a test message to peek (2)';
 $msgid = $conn->send($queuename, $msg, array(SAM_CORRELID => '1111'));
 if (!$msgid) {
     echo '<font color="red"><b>FAILED</b></font>' . " send(2) failed ({$conn->errno}) {$conn->error}";
 } else {
     $msg->body = 'This is a test message to peek (3)';
     $msgid = $conn->send($queuename, $msg, array(SAM_CORRELID => '1111'));
     if (!$msgid) {
         echo '<font color="red"><b>FAILED</b></font>' . " send(3) failed ({$conn->errno}) {$conn->error}";
     } else {
         $msg->body = 'This is a test message to peek (4)';
         $msgid = $conn->send($queuename, $msg, array(SAM_CORRELID => '1111'));
         if (!$msgid) {
             echo '<font color="red"><b>FAILED</b></font>' . " send(4) failed ({$conn->errno}) {$conn->error}";
         } else {
             $ar = $conn->peekAll($queuename, array(SAM_CORRELID => '1111'));
             if (!$ar) {
                 echo '<font color="red"><b>FAILED</b></font>' . " peekAll failed ({$conn->errno}) {$conn->error}";
             } else {
                 $x = sizeof($ar);
                 if ($x != 4) {
                     echo '<font color="red"><b>FAILED</b></font>' . " peekAll failed. Array size=" . sizeof($ar) . " should be 4!";
                 }
                 foreach ($ar as $msg) {
                     if (!$conn->remove($queuename, array(SAM_MESSAGEID => $msg->header->SAM_MESSAGEID))) {
                         echo '<font color="red"><b>FAILED</b></font> remove failed ' . "({$conn->errno}) {$conn->error}";
                     } else {
                         $x -= 1;
                     }
                 }
                 if ($x == 0) {