Ejemplo n.º 1
0
 /**
  * Tests Stomp->commit()
  */
 public function testCommit()
 {
     // TODO Auto-generated StompTest->testCommit()
     $this->markTestIncomplete("commit test not implemented");
     $this->Stomp->commit();
 }
Ejemplo n.º 2
0
$con->begin("tx1");
for ($i = 1; $i < 3; $i++) {
    $con->send("/queue/transactions", $i, array("transaction" => "tx1"));
}
// if we abort transaction, messages will not be sent
$con->abort("tx1");
// now send some messages for real
$con->begin("tx2");
echo "Sent messages {\n";
for ($i = 1; $i < 5; $i++) {
    echo "\t{$i}\n";
    $con->send("/queue/transactions", $i, array("transaction" => "tx2"));
}
echo "}\n";
// they will be available for consumers after commit
$con->commit("tx2");
// try to receive some messages
$con->begin("tx3");
$messages = array();
for ($i = 1; $i < 3; $i++) {
    $msg = $con->readFrame();
    array_push($messages, $msg);
    $con->ack($msg, "tx3");
}
// of we abort transaction, we will "rollback" out acks
$con->abort("tx3");
$con->begin("tx4");
// so we need to ack received messages again
// before we can receive more (prefetch = 1)
if (count($messages) != 0) {
    foreach ($messages as $msg) {