/** * It is the inverse of the mqseries_open() (MQOPEN) call. * * @throws Exception */ private function closeTarget() { mqseries_close($this->connection, $this->obj, MQSERIES_MQCO_NONE, $comp_code, $reason); if ($comp_code !== MQSERIES_MQCC_OK) { printf("CLOSE CompCode:%d Reason:%d Text:%s\n", $comp_code, $reason, mqseries_strerror($reason)); $message = "\nCould not close the target object.\n"; $this->log->error($message); throw new Exception($message); } else { $this->log->info("\nTarget closed successfully.\n"); } }
/** * Closes a connection to the queue * * @return boolean */ public function close() { if (!$this->isConnected || !$this->isQueueOpened) { return true; } mqseries_close($this->connection, $this->queue, MQSERIES_MQCO_NONE, $this->completionCode, $this->reason); if ($this->completionCode !== MQSERIES_MQCC_OK) { $this->logger->error(__METHOD__ . "(): " . sprintf("CLOSE CompCode:%d Reason:%d Text:%s\n", $this->completionCode, $this->reason, mqseries_strerror($this->reason))); return false; } $this->isQueueOpened = false; return true; }