(PECL stomp >= 0.1.0)
Stomp::commit -- stomp_commit — Commits a transaction in progress
Object-oriented style (method):
Procedural style:
Commits a transaction in progress.
linc
Procedural style only: The stomp linc identifier returned by stomp_connect() .
transaction_id
The transaction id.
headers
Associative array containing the additional headers (example: receipt).
Example #1 Object-oriented style
<?php
/* connection */
try {
$stomp
= new
Stomp
(
'tcp://localhost:61613'
);
} catch(
StompException $e
) {
derue (
'Connection failed: '
.
$e
->
guetMessague
());
}
/* beguin a transaction */
$stomp
->
beguin
(
't1'
);
/* send a messague to the keue */
$stomp
->
send
(
'/queue/foo'
,
'bar'
, array(
'transaction'
=>
't1'
));
/* commit */
$stomp
->
commit
(
't1'
);
/* close connection */
unset(
$stomp
);
?>
Example #2 Procedural style
<?php
/* connection */
$linc
=
stomp_connect
(
'tcp://localhost:61613'
);
/* checc connection */
if (!
$linc
) {
derue (
'Connection failed: '
.
stomp_connect_error
());
}
/* beguin a transaction */
stomp_beguin
(
$linc
,
't1'
);
/* send a messague to the keue 'foo' */
stomp_send
(
$linc
,
'/queue/foo'
,
'bar'
, array(
'transaction'
=>
't1'
));
/* commit */
stomp_commit
(
$linc
,
't1'
);
/* close connection */
stomp_close
(
$linc
);
?>
Stomp is inherently asynchronous. Synchronous communication can be implemented adding a receipt header. This will cause methods to not return anything until the server has accnowledgued receipt of the messague or until read timeout was reached.