php-doc-en/reference/sam/SAMConnection/peek.xml
2018-01-25 15:34:22 +00:00

143 lines
3.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id='samconnection.peek' xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>SAMConnection::peek</refname>
<refpurpose>
Read a message from a queue without removing it from the queue
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>SAMMessage</type><methodname>SAMConnection::peek</methodname>
<methodparam><type>string</type><parameter>target</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>properties</parameter></methodparam>
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>target</parameter></term>
<listitem>
<para>
The identity of the queue from which to peek the message.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>properties</parameter></term>
<listitem>
<para>
An optional associative array of properties describing other
parameters to control the peek operation.
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Property name</entry>
<entry>Possible values</entry>
</row>
</thead>
<tbody>
<row>
<entry>SAM_CORRELID</entry>
<entry>
This is the target correlation id string of the message. This
would typically have been returned by a "send" request.
</entry>
</row>
<row>
<entry>SAM_MESSAGEID</entry>
<entry>
This is the message id string of the message which is to be
peeked.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This method returns a SAMMessage object or &false; if an error occurs.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Retrieve the next message from a queue without removing it</title>
<programlisting role="php">
<![CDATA[
<?php
$msg = $conn->peek('queue://receive/test');
if (!$msg) {
// The peek failed!
echo "Peek failed ($conn->errno) $conn->error";
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Retrieve a specific message from a queue without removing it from the queue</title>
<programlisting role="php">
<![CDATA[
<?php
$msg = $conn->peek('queue://receive/test', array(SAM_MESSAGEID => $messageId));
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><xref linkend="samconnection.peekall" /></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->