commitTransaction() public method

Commit a pending transaction.
public commitTransaction ( ) : boolean
return boolean TRUE on success or FALSE on failure.
コード例 #1
0
ファイル: Channel.php プロジェクト: Evaneos/Hector
 /**
  * @return bool
  */
 public function commitTransaction()
 {
     if (!$this->isInitialized()) {
         $this->initialize();
     }
     return $this->channel->commitTransaction();
 }
コード例 #2
0
ファイル: Channel.php プロジェクト: treehouselabs/queue
 /**
  * @inheritdoc
  */
 public function commitTransaction()
 {
     try {
         return $this->delegate->commitTransaction();
     } catch (\AMQPChannelException $e) {
         throw new ChannelException($e->getMessage(), $e->getCode(), $e);
     } catch (\AMQPConnectionException $e) {
         throw new ConnectionException($e->getMessage(), $e->getCode(), $e);
     }
 }
コード例 #3
0
ファイル: Channel.php プロジェクト: csharpru/yii2-amqp
 /**
  * @return bool
  */
 public function commitTransaction()
 {
     try {
         return $this->rawChannel->commitTransaction();
     } catch (\Exception $e) {
         ClientHelper::throwRightException($e);
     }
 }
コード例 #4
0
ファイル: ChannelSpec.php プロジェクト: Evaneos/Hector
 public function it_should_rollback_if_transaction_failed(\AMQPChannel $channel)
 {
     $channel->startTransaction()->shouldBeCalled();
     $channel->commitTransaction()->shouldNotBeCalled();
     $channel->rollbackTransaction()->shouldBeCalled();
     $exception = new \Exception('Whhooops');
     $process = function (Channel $channel) use($exception) {
         throw $exception;
     };
     $this->shouldThrow(new HectorException('Transaction failed', 255, $exception))->during('transaction', [$process]);
 }
コード例 #5
0
 public function send($msg)
 {
     $channel = new \AMQPChannel($this->connection);
     $exchange = new \AMQPExchange($channel);
     $exchange->setFlags(AMQP_DURABLE);
     $exchange->setName('exchange2');
     $exchange->setType('direct');
     //$exchange->declare();
     $exchange->declareExchange();
     $queue = new \AMQPQueue($channel);
     $queue->setName('series');
     $queue->setFlags(AMQP_DURABLE | AMQP_AUTODELETE);
     //$queue->declare();
     $queue->declareQueue();
     $queue->bind('exchange2', 'series');
     $channel->startTransaction();
     $message = $exchange->publish(json_encode($msg), 'series', AMQP_MANDATORY, array('content_type' => 'application/json', 'delivery_mode' => 2));
     $channel->commitTransaction();
     if (!$message) {
         throw new \SYSTEM\LOG\ERROR("Error: Message '" . $message . "' was not sent to queue.!");
     }
 }
コード例 #6
0
ファイル: producer.php プロジェクト: wanggeopens/own-libs
<?php

require 'config.php';
$connection = new AMQPConnection($connect);
$connection->connect();
$channel = new AMQPChannel($connection);
$exchange = new AMQPExchange($channel);
$exchange->setName($exname);
$exchange->setType(AMQP_EX_TYPE_TOPIC);
$exchange->setFlags(AMQP_DURABLE);
$exchange->declare();
$queue = new AMQPQueue($channel);
$queue->setName($qname);
$queue->setFlags(AMQP_DURABLE);
$queue->declare();
$queue->bind($exname, $routekey);
$channel->startTransaction();
$message = json_encode(array('Hello World! 测试消息!', 'TOPIC'));
$exchange->publish($message, $routekey);
$channel->commitTransaction();
$connection->disconnect();
コード例 #7
0
ファイル: Channel.php プロジェクト: prolic/HumusAmqp
 /**
  * @inheritdoc
  */
 public function commitTransaction()
 {
     $this->channel->commitTransaction();
 }
コード例 #8
0
 /**
  * {@inheritDoc}
  */
 public function commit($key = null)
 {
     $this->channel->commitTransaction();
 }