<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<refentry xml:id="stomp.commit" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>Stomp::commit</refname>
  <refname>stomp_commit</refname>
  <refpurpose>Commits a transaction in progress</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <para>&style.oop; (method):</para>
   <methodsynopsis>
   <modifier>public</modifier> <type>bool</type><methodname>Stomp::commit</methodname>
   <methodparam><type>string</type><parameter>transaction_id</parameter></methodparam>
   <methodparam choice="opt"><type>array</type><parameter>headers</parameter></methodparam>
   </methodsynopsis>
  <para>&style.procedural;:</para>
  <methodsynopsis>
   <type>bool</type><methodname>stomp_commit</methodname>
   <methodparam><type>resource</type><parameter>link</parameter></methodparam>
   <methodparam><type>string</type><parameter>transaction_id</parameter></methodparam>
   <methodparam choice="opt"><type>array</type><parameter>headers</parameter></methodparam>
  </methodsynopsis>
  <para>
   Commits a transaction in progress.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    &stomp.param.link;
    <varlistentry>
     <term><parameter>transaction_id</parameter></term>
     <listitem>
      <para>
       The transaction id. 
      </para>
     </listitem>
    </varlistentry>
    &stomp.param.headers;
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </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());
}

/* begin a transaction */
$stomp->begin('t1');

/* send a message to the queue */
$stomp->send('/queue/foo', 'bar', array('transaction' => 't1'));

/* commit */
$stomp->commit('t1');

/* close connection */
unset($stomp);

?>
]]>
     </programlisting>
   </example>
  </para>
  <para>
   <example>
    <title>&style.procedural;</title>
    <programlisting role="php">
<![CDATA[
<?php

/* connection */
$link = stomp_connect('tcp://localhost:61613');

/* check connection */
if (!$link) {
    die('Connection failed: ' . stomp_connect_error());
}

/* begin a transaction */
stomp_begin($link, 't1');

/* send a message to the queue 'foo' */
stomp_send($link, '/queue/foo', 'bar', array('transaction' => 't1'));

/* commit */
stomp_commit($link, 't1');

/* close connection */
stomp_close($link);

?>
]]>
     </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  &stomp.note.sync;
 </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
-->
