mirror of
https://github.com/php/doc-en.git
synced 2026-03-23 23:32:18 +01:00
207 lines
4.4 KiB
XML
207 lines
4.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="stomp.readframe" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>Stomp::readFrame</refname>
|
|
<refname>stomp_read_frame</refname>
|
|
<refpurpose>Reads the next frame</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<para>&style.oop; (method):</para>
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>stompframe</type><methodname>Stomp::readFrame</methodname>
|
|
<methodparam choice="opt"><type>string</type><parameter>class_name</parameter><initializer>"stompFrame"</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>&style.procedural;:</para>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>stomp_read_frame</methodname>
|
|
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Reads the next frame. It is possible to instantiate an object of a specific class, and pass parameters to that class's constructor.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
&stomp.param.link;
|
|
<varlistentry>
|
|
<term><parameter>class_name</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The name of the class to instantiate. If not specified, a stompFrame object is returned.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
&stomp.note.transaction;
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>PECL stomp 0.4.0</entry>
|
|
<entry>
|
|
<parameter>class_name</parameter> parameter was added.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>&style.oop;</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
/* connection */
|
|
try {
|
|
$stomp = new Stomp('tcp://localhost:61613');
|
|
} catch(StompException $e) {
|
|
die('Connection failed: ' . $e->getMessage());
|
|
}
|
|
|
|
/* subscribe to messages from the queue 'foo' */
|
|
$stomp->subscribe('/queue/foo');
|
|
|
|
/* read a frame */
|
|
var_dump($stomp->readFrame());
|
|
|
|
/* close connection */
|
|
unset($stomp);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
object(StompFrame)#2 (3) {
|
|
["command"]=>
|
|
string(7) "MESSAGE"
|
|
["headers"]=>
|
|
array(5) {
|
|
["message-id"]=>
|
|
string(41) "ID:php.net-55293-1257226743606-4:2:-1:1:1"
|
|
["destination"]=>
|
|
string(10) "/queue/foo"
|
|
["timestamp"]=>
|
|
string(13) "1257226805828"
|
|
["expires"]=>
|
|
string(1) "0"
|
|
["priority"]=>
|
|
string(1) "0"
|
|
}
|
|
["body"]=>
|
|
string(3) "bar"
|
|
}
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>&style.procedural;</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
/* connection */
|
|
$link = stomp_connect('ssl://localhost:61612');
|
|
|
|
/* check connection */
|
|
if (!$link) {
|
|
die('Connection failed: ' . stomp_connect_error());
|
|
}
|
|
|
|
/* subscribe to messages from the queue 'foo' */
|
|
stomp_subscribe($link, '/queue/foo');
|
|
|
|
/* read a frame */
|
|
$frame = stomp_read_frame($link);
|
|
|
|
/* close connection */
|
|
stomp_close($link);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
array(3) {
|
|
["command"]=>
|
|
string(7) "MESSAGE"
|
|
["body"]=>
|
|
string(3) "bar"
|
|
["headers"]=>
|
|
array(6) {
|
|
["transaction"]=>
|
|
string(2) "t1"
|
|
["message-id"]=>
|
|
string(41) "ID:php.net-55293-1257226743606-4:3:-1:1:1"
|
|
["destination"]=>
|
|
string(10) "/queue/foo"
|
|
["timestamp"]=>
|
|
string(13) "1257227037059"
|
|
["expires"]=>
|
|
string(1) "0"
|
|
["priority"]=>
|
|
string(1) "0"
|
|
}
|
|
}
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|