(PECL stomp >= 0.1.0)
Stomp::commit -- stomp_commit โ Commits a transaction in progress
ใชใใธใงใฏใๆๅๅ (method):
ๆ็ถใๅ:
Commits a transaction in progress.
link
ๆ็ถใๅใฎใฟ: stomp_connect() ใ่ฟใ stomp ใชใณใฏ IDใ
transaction_id
The transaction id.
headers
่ฟฝๅ ใฎใใใ (ไพ: receipt) ใๅซใ้ฃๆณ้ ๅใ
ไพ1 ใชใใธใงใฏใๆๅๅ
<?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);
?>
ไพ2 ๆ็ถใๅ
<?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);
?>
Stomp ใฏๆฌๆฅ้ๅๆใงใใๅๆ้ไฟกใๅฎ่ฃ ใใใซใฏ receipt ใใใใ่ฟฝๅ ใใพใใใใใ่ฟฝๅ ใใใจใใตใผใใผใใกใใปใผใธใๅ้ ใใใใฟใคใ ใขใฆใใซ้ใใใพใงใฏใกใฝใใใไฝใ่ฟใใชใใใใซใชใใพใใ