1
0
mirror of https://github.com/php/doc-fr.git synced 2026-04-28 01:03:22 +02:00
Files
2026-01-25 16:23:50 +00:00

199 lines
4.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 9c7e8795cb8933358082986ad62fd918a3fcf6a4 Maintainer: pierrick Status: ready -->
<!-- Reviewed: no -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="stomp.readframe">
<refnamediv>
<refname>Stomp::readFrame</refname>
<refname>stomp_read_frame</refname>
<refpurpose>Lit le prochain message</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<simpara>&style.oop; (méthode) :</simpara>
<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>
<simpara>&style.procedural; :</simpara>
<methodsynopsis>
<type>array</type><methodname>stomp_read_frame</methodname>
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
</methodsynopsis>
<simpara>
Lit le prochain message. Il est possible d'instancier un objet d'une classe spécifique, et de passer les paramètres au constructeur de cette classe.
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
&stomp.param.link;
<varlistentry>
<term><parameter>class_name</parameter></term>
<listitem>
<simpara>
Le nom de la classe à instancier. Si ce paramètre n'est pas spécifié, un objet stompFrame est retourné.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
&stomp.note.transaction;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>PECL stomp 0.4.0</entry>
<entry>
Le paramètre <parameter>class_name</parameter> a été ajouté.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>&style.oop;</title>
<programlisting role="php">
<![CDATA[
<?php
/* connexion */
try {
$stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
die('Connection failed: ' . $e->getMessage());
}
/* souscription aux messages de la file 'foo' */
$stomp->subscribe('/queue/foo');
/* lecture d'un message */
var_dump($stomp->readFrame());
/* fermeture de la connexion */
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>
<example>
<title>&style.procedural;</title>
<programlisting role="php">
<![CDATA[
<?php
/* connexion */
$link = stomp_connect('ssl://localhost:61612');
/* verification de la connexion */
if (!$link) {
die('Connection failed: ' . stomp_connect_error());
}
/* souscription aux messages de la file 'foo' */
stomp_subscribe($link, '/queue/foo');
/* lecture d'un message */
$frame = stomp_read_frame($link);
/* fermeture de la connexion */
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>
</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
-->