Exemplo n.º 1
0
 /**
  * Close the running connection
  */
 public function close()
 {
     if (null !== $this->connection && $this->connection->isConnected()) {
         $this->channel->close();
         $this->connection->close();
     }
 }
Exemplo n.º 2
0
 /**
  *
  */
 public function __destruct()
 {
     if ($this->connection) {
         $this->channel->close();
         $this->connection->close();
     }
 }
Exemplo n.º 3
0
 public function __destroy()
 {
     if ($this->_channel) {
         $this->_channel->close();
     }
     if ($this->getConnection && $this->getConnection->isConnected()) {
         $this->getConnection->close();
     }
 }
Exemplo n.º 4
0
 public function tearDown()
 {
     if ($this->ch2) {
         $this->ch2->close();
     }
     if ($this->conn) {
         $this->conn->close();
     }
 }
Exemplo n.º 5
0
 public function tearDown()
 {
     if ($this->ch) {
         $this->ch->exchange_delete($this->exchange_name);
         $this->ch->close();
     }
     if ($this->conn) {
         $this->conn->close();
     }
 }
 public function tearDown()
 {
     try {
         $this->object->deleteQueue('/', self::QUEUE_TEST_NAME);
     } catch (\Exception $e) {
     }
     try {
         $this->object->deleteExchange('/', self::EXCHANGE_TEST_NAME);
     } catch (\Exception $e) {
     }
     $this->channel->close();
     $this->conn->close();
 }
 public function actionIndex()
 {
     Yii::info('Started email task', __METHOD__);
     $this->setupConnection();
     echo '[*] Waiting for messages. To exit press CTRL+C', "\n";
     $this->channel->basic_qos(null, 1, null);
     $this->channel->basic_consume($this->queue, '', false, false, false, false, [$this, 'processEmail']);
     while (count($this->channel->callbacks)) {
         $this->channel->wait();
     }
     echo 'Shutting down...', "\n";
     Yii::info('Shutting down...', __METHOD__);
     Yii::trace('Disconnecting...', __METHOD__);
     $this->channel->close();
     $this->connection->close();
     return self::EXIT_CODE_NORMAL;
 }
Exemplo n.º 8
0
 public function disconnect()
 {
     if ($this->isConnected()) {
         $this->channel->close();
         $this->connection->close();
         $this->logger->info("Mq Service Disconnected");
     }
 }
 /**
  * @inherit
  */
 public function sendMessage()
 {
     $msg = new AMQPMessage($this->data, $this->messageProperties);
     $this->channel->basic_publish($msg, $this->publishExchange, $this->publishRoutingKey, $this->publishMandatory, $this->publishImmediate, $this->publishTicket);
     $this->channel->close();
     $this->connection->close();
     return true;
 }
 /**
  */
 public function shutdown()
 {
     if ($this->channel) {
         $this->channel->close();
     }
     if ($this->connection) {
         $this->connection->close();
     }
 }
Exemplo n.º 11
0
 /**
  * @return void
  */
 protected function closeChannel()
 {
     $this->channel = null;
     if ($this->channel instanceof AMQPChannel) {
         $channelId = $this->channel->getChannelId();
         $this->channel->close();
         $this->logger->info('Channel clossed!', [$channelId]);
     }
 }
Exemplo n.º 12
0
 public function close()
 {
     if ($this->channel != null) {
         $this->channel->close();
     }
     if ($this->connection != null) {
         $this->connection->close();
     }
 }
 public function closeConnection()
 {
     if ($this->channel) {
         $this->channel->close();
     }
     if ($this->connection) {
         $this->connection->close();
     }
     $this->isQueueSetup = false;
     return $this;
 }
Exemplo n.º 14
0
 /**
  * Отключаемся
  *
  * @return bool
  */
 protected function _disconnect()
 {
     try {
         if ($this->_connected) {
             $this->_Channel->close();
             $this->_Connection->close();
         }
     } catch (\Exception $e) {
     }
     $this->_Channel = $this->_Connection = null;
     $this->_connected = false;
     return !$this->_connected;
 }
Exemplo n.º 15
0
 /**
  * Close channel and connection
  */
 public function close()
 {
     $this->channel && $this->channel->close();
     $this->connection->close();
 }
Exemplo n.º 16
0
 public function close($exchange_name)
 {
     $this->channel->close();
     $this->connection->close();
 }
 /**
  * Close channel
  */
 protected function closeChannel()
 {
     $this->channel->close();
     $this->channel = null;
 }
Exemplo n.º 18
0
 /**
  * Closes channel and connection
  */
 public function closeConnection()
 {
     $this->_channel->close();
     $this->_connect->close();
 }
Exemplo n.º 19
0
 public function shutdown()
 {
     $this->channel->close();
     $this->connection->close();
 }
Exemplo n.º 20
0
 /**
  * @param AMQPChannel          $channel
  * @param AMQPStreamConnection $connection
  */
 public static function shutdown(AMQPChannel $channel, AMQPStreamConnection $connection)
 {
     $channel->close();
     $connection->close();
 }
Exemplo n.º 21
0
 /**
  * Closes the channel and connection
  */
 public function close()
 {
     $this->channel->close();
     return (bool) $this->conn->close();
 }
Exemplo n.º 22
0
 private function tryClose(AMQPChannel $channel)
 {
     try {
         $channel->close();
     } catch (\Exception $ex) {
         $this->logger->info("Unable to close channel. It might already be closed.");
     }
 }
Exemplo n.º 23
0
 public function __destruct()
 {
     $this->channel->close();
 }
Exemplo n.º 24
0
/**
 * @param \PhpAmqpLib\Channel\AMQPChannel $ch
 * @param \PhpAmqpLib\Connection\AbstractConnection $conn
 */
function shutdown($ch, $conn)
{
    $ch->close();
    $conn->close();
}
Exemplo n.º 25
0
 /**
  * Disconnect amqp connection
  */
 public function disconnect()
 {
     $this->channel->close();
     $this->amqpConnection->close();
 }
Exemplo n.º 26
0
 /**
  * @return mixed
  */
 public function close()
 {
     return $this->channel->close();
 }
Exemplo n.º 27
0
 public function __destruct()
 {
     $this->ch->close();
     $this->conn->close();
 }