예제 #1
0
 /**
  * Commit a pending transaction.
  *
  * @throws AMQPChannelException    If no transaction was started prior to
  *                                 calling this method.
  * @throws AMQPConnectionException If the connection to the broker was lost.
  *
  * @return bool TRUE on success or FALSE on failure.
  */
 public function commitTransaction()
 {
     if (!$this->tx) {
         throw new AMQPChannelException('No transaction in progress.');
     }
     try {
         $this->channel->tx_commit();
     } catch (Exception $e) {
         throw new AMQPConnectionException($e->getMessage(), $e->getCode(), $e->getPrevious());
     }
     return true;
 }
 public function afterCommit(UnitOfWorkInterface $unitOfWork)
 {
     if ($this->isOpen) {
         try {
             if ($this->getTerminalProperty('isTransactional')) {
                 $this->channel->tx_commit();
             } else {
                 if ($this->getTerminalProperty('waitForAck')) {
                     $this->waitForConfirmations();
                 }
             }
         } catch (\Exception $ex) {
             $this->logger->warn("Unable to commit transaction on channel.");
         }
         $this->closeTerminal();
     }
 }
예제 #3
0
 /**
  * @inheritdoc
  */
 public function commitTransaction()
 {
     $this->channel->tx_commit();
 }