PHP 8.5.0 RC 2 available for testing

Stomp::commit

stomp_commit

(PECL stomp >= 0.1.0)

Stomp::commit -- stomp_commit โ€” Commits a transaction in progress

่ชฌๆ˜Ž

ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆๆŒ‡ๅ‘ๅž‹ (method):

public Stomp::commit(string $transaction_id, array $headers = ?): bool

ๆ‰‹็ถšใๅž‹:

stomp_commit(resource $link, string $transaction_id, array $headers = ?): bool

Commits a transaction in progress.

ใƒ‘ใƒฉใƒกใƒผใ‚ฟ

link

ๆ‰‹็ถšใๅž‹ใฎใฟ: stomp_connect() ใŒ่ฟ”ใ™ stomp ใƒชใƒณใ‚ฏ IDใ€‚

transaction_id

The transaction id.

headers

่ฟฝๅŠ ใฎใƒ˜ใƒƒใƒ€ (ไพ‹: receipt) ใ‚’ๅซใ‚€้€ฃๆƒณ้…ๅˆ—ใ€‚

ๆˆปใ‚Šๅ€ค

ๆˆๅŠŸใ—ใŸๅ ดๅˆใซ true ใ‚’ใ€ๅคฑๆ•—ใ—ใŸๅ ดๅˆใซ false ใ‚’่ฟ”ใ—ใพใ™ใ€‚

ไพ‹

ไพ‹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 ใƒ˜ใƒƒใƒ€ใ‚’่ฟฝๅŠ ใ—ใพใ™ใ€‚ใ“ใ‚Œใ‚’่ฟฝๅŠ ใ™ใ‚‹ใจใ€ใ‚ตใƒผใƒใƒผใŒใƒกใƒƒใ‚ปใƒผใ‚ธใ‚’ๅ—้ ˜ใ™ใ‚‹ใ‹ใ‚ฟใ‚คใƒ ใ‚ขใ‚ฆใƒˆใซ้”ใ™ใ‚‹ใพใงใฏใƒกใ‚ฝใƒƒใƒ‰ใŒไฝ•ใ‚‚่ฟ”ใ•ใชใ„ใ‚ˆใ†ใซใชใ‚Šใพใ™ใ€‚

๏ผ‹add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top