1

mail@pastecode.io avatar
unknown
java
a year ago
1.3 kB
2
Indexable
Never
private void initConnectionToOutQueue() {
		if (queueManager != null 
				&& queueManager.isConnected()
				&& outQueue.isOpen()) {
			return;
		}
		try {
			WMQHandler MyWMQHandlerI = new WMQHandler(Parameter.MQIPHost,
					Integer.parseInt(Parameter.MQPort), Parameter.MQMgrName,
					Parameter.MQChannel, Parameter.MQNameViettel);
			publishInfo(Func.getTime() + " Thong tin ket noi Q.InMsg:"
					+ Parameter.MQIPHost + "," + Parameter.MQPort + ","
					+ Parameter.MQMgrName + "," + Parameter.MQChannel + ","
					+ Parameter.MQNameViettel);
			queueManager = MyWMQHandlerI.accessQMgr();
			int openOptionsI = 8208 | MQC.MQOO_INQUIRE;
			outQueue = queueManager.accessQueue(Parameter.MQNameViettel,
					openOptionsI);
			publishInfo(Func.getTime() + " Ket noi Queue: "
					+ Parameter.MQNameViettel + " thanh cong");
		} catch (Exception e) { Func.logNew(Func.getStackTrace(e));
			e.printStackTrace();
			currentRetryCount += 1;
			if (currentRetryCount < maxRetry) {
				publishInfo("Kết nối tới queue Viettel lỗi, đang thử lại");
				initConnectionToOutQueue();
			} else {
				publishInfo("Kết nối tới queue Viettel lỗi");
				currentRetryCount = 0;
				connectCount = 0;
				disConnect();
			}
		}
	}