/// <summary> /// 재시도 함수 /// </summary> private void tryAgain() { libMyUtil.clsMSMQ objMSMQ = new libMyUtil.clsMSMQ(); System.Diagnostics.Stopwatch objWatch = new System.Diagnostics.Stopwatch(); int retryMsgCnt; int i; while (objMSMQ.canReadQueue(qPath_retry)) { retryMsgCnt = objMSMQ.queueMsgCnt(this.qPath_retry); for (i = 0; i < retryMsgCnt; i++) { libMyUtil.pageCallingInfo rcvObj = (libMyUtil.pageCallingInfo)objMSMQ.peekData(this.qPath_retry, this.objType, this.rcvTimeOut); if ((System.DateTime.Now - rcvObj.lastTry).Duration().TotalMilliseconds < this.retryInterval) { break; } prcRcvObject(objMSMQ.receiveData(this.qPath_retry, this.objType, this.rcvTimeOut)); } System.Threading.Thread.Sleep(this.retryInterval); } libMyUtil.clsThread.SetLabel(RetryCallerState, "오류"); MessageBox.Show(string.Format("해당큐({0})에 접근할 수 없습니다.", qPath_retry)); }
/// <summary> /// 메인 함수 /// </summary> private void RunCaller() { libMyUtil.clsMSMQ objMSMQ = new libMyUtil.clsMSMQ(); while (objMSMQ.canReadQueue(qPath)) { prcRcvObject(objMSMQ.receiveData(this.qPath, this.objType, this.rcvTimeOut)); } libMyUtil.clsThread.SetLabel(MainCallerState, "오류"); MessageBox.Show(string.Format("해당큐({0})에 접근할 수 없습니다.", qPath)); }
private void runTest() { libMyUtil.clsMSMQ objMSMQ = new libMyUtil.clsMSMQ(); if (objMSMQ.canReadQueue(qPath)) { while (start) { object rcvData = objMSMQ.receiveData(qPath, new Type[] { typeof(long) }, 5); if (rcvData != null) { long rcvNum = (long)rcvData; objUtil.writeLog(rcvNum.ToString()); } } } else { MessageBox.Show("접근 불가"); } }