示例#1
0
 /**
  * Breaks the connection between the queue manager and the application.
  *
  * @throws Exception
  */
 private function disconnect()
 {
     mqseries_disc($this->connection, $comp_code, $reason);
     if ($comp_code !== MQSERIES_MQCC_OK) {
         printf("disc CompCode:%d Reason:%d Text:%s<br>\n", $comp_code, $reason, mqseries_strerror($reason));
         $message = "\nCould not disconnect.\n";
         $this->log->error($message);
         throw new Exception($message);
     } else {
         $this->log->info("\nApplication successfully disconnected.\n");
     }
 }
示例#2
0
 /**
  * Disconnect an open connection to an MQ Server
  * 
  * @return boolean
  */
 public function disconnect()
 {
     if (!$this->isConnected || $this->connection === null) {
         $this->isConnected = false;
         return true;
     }
     mqseries_disc($this->connection, $this->completionCode, $this->reason);
     if ($this->completionCode !== MQSERIES_MQCC_OK) {
         $this->logger->error(__METHOD__ . "(): " . sprintf("DISC CompCode:%d Reason:%d Text:%s\n", $this->completionCode, $this->reason, mqseries_strerror($this->reason)));
         return false;
     }
     $this->isQueueOpened = false;
     $this->isConnected = false;
     return true;
 }