private void runTest() { libMyUtil.clsMSMQ objMSMQ = new libMyUtil.clsMSMQ(); long sendData = 0; if (objMSMQ.canReadQueue(qPath)) { while (start) { objMSMQ.sendData(qPath, sendData); sendData++; } } else { MessageBox.Show("접근 불가"); } }
/// <summary> /// 수신된 메시지 처리, null수신시 sleep /// </summary> private void prcRcvObject(object rcvObj) { if (rcvObj != null) { System.Diagnostics.Stopwatch objWatch = new System.Diagnostics.Stopwatch(); objWatch.Start(); libMyUtil.clsMSMQ objMSMQ = new libMyUtil.clsMSMQ(); libMyUtil.pageCallingInfo callingInfo = (libMyUtil.pageCallingInfo)rcvObj; string Result; string url = callingInfo.url; string postData = callingInfo.postData; int timeOut = callingInfo.timeOut; if (callingInfo.httpMethod.Equals("POST")) { Result = libMyUtil.clsWeb.SendPostData(postData, url, this.encodeType, timeOut * 1000); } else if (callingInfo.httpMethod.Equals("GET")) { Result = libMyUtil.clsWeb.SendQueryString(postData, url, timeOut * 1000); } else { Result = "UNKNOWN HTTP METHOD"; } objUtil.writeLog(string.Format("CALL RESULT : {0}\r\nFKEY:{1}\r\nURL:{2}", Result, callingInfo.FKEY, callingInfo.url)); if (Result.Equals(callingInfo.callresult)) { UpdateResult(callingInfo, Result);//성공 결과 DB에 저장 } else if (Result.Equals("FAIL")) { //재시도 callingInfo.failCnt++; //실패 카운트 증가 callingInfo.lastTry = System.DateTime.Now; //시간 기록 if (callingInfo.failCnt < this.MaxCallingFailCnt) //설정한 횟수만큼 재시도 { objMSMQ.sendData(qPath_retry, callingInfo); //재시도 큐에 저장 } else { callingInfo.writeLog(Result); //최종 실패 메시지 로그 기록 UpdateResult(callingInfo, Result); //실패 결과 DB에 저장 } } else { callingInfo.writeLog(Result); //최종 실패 메시지 로그 기록 UpdateResult(callingInfo, Result); //실패 결과 DB에 저장 } objWatch.Stop(); if (System.DateTime.Now.Millisecond > 500) { objUtil.writeLog(string.Format("TIME SPAN : {0} millisecond", objWatch.Elapsed.TotalMilliseconds.ToString())); } } else { System.Threading.Thread.Sleep(this.sleep);//큐에 메시지 없으면 슬립 } }