public List <ExceptionCoreTb> GetAllExceptionByBusinessID(String bussinesID) { if (String.IsNullOrEmpty(bussinesID)) { return(ExceptionCoreTb.FindAll()); } else { return(ExceptionCoreTb.FindAll(ExceptionCoreTb._.BusinessID, bussinesID)); } }
/// <summary> /// 抛出异常并写日志, 并需要记录异常的时间 /// </summary> /// <param name="message"></param> /// <param name="binding"></param> /// <param name="request"></param> public static Exception ExceptionAndLog(CallState state, String exceptionDesc, String message, BindingTemplate binding, ESB.Core.Schema.务请求 request) { String messageID = String.Empty; String exceptionMessage = String.Format("{0}:{1}", exceptionDesc, message); if (state.CallBeginTime.Year != DateTime.Now.Year) { state.CallBeginTime = DateTime.Now; } if (state.CallEndTime.Year != DateTime.Now.Year) { state.CallEndTime = DateTime.Now; } if (binding != null) { messageID = AddAuditLog(0, binding, state.RequestBeginTime, state.RequestEndTime, state.CallBeginTime, state.CallEndTime , exceptionMessage, request); } else { messageID = AddAuditLog(0, "00000000-0000-0000-0000-000000000000" , String.Empty, string.Empty, state.RequestBeginTime, state.RequestEndTime, state.CallBeginTime, state.CallEndTime , exceptionMessage, request); } ExceptionCoreTb exception = new ExceptionCoreTb() { ExceptionID = Guid.NewGuid(), BindingTemplateID = binding == null ? Guid.Empty : binding.TemplateID, BindingType = 0, Description = exceptionDesc, ExceptionCode = String.Empty, ExceptionInfo = exceptionMessage, ExceptionLevel = 0, ExceptionStatus = 0, ExceptionTime = DateTime.Now, ExceptionType = 0, HostName = request.主机名称, MessageBody = request.消息内容, MessageID = new Guid(messageID), MethodName = request.方法名称, RequestPwd = request.密码, RequestType = 0 }; exception.Insert(); return(new Exception(message)); }
/// <summary> /// 重新发送消息 /// </summary> private void ResendMessage() { lock (m_ResendLock) { //--检测成功消息,并重新发送 String[] successFiles = Directory.GetFiles(m_SuccessPath); if (successFiles.Length > 0) { for (int i = 0; i < successFiles.Length; i++) { String message = File.ReadAllText(successFiles[i]); AuditBusiness ab = XmlUtil.LoadObjFromXML <AuditBusiness>(message); m_MonitorClient.SendAuditMessage(ab); File.Delete(successFiles[i]); } } //--检测异常消息,并重新发送 String[] failureFiles = Directory.GetFiles(m_FailurePath); if (failureFiles.Length > 0) { for (int i = 0; i < failureFiles.Length; i++) { String message = File.ReadAllText(failureFiles[i]); ExceptionCoreTb ab = XmlUtil.LoadObjFromXML <ExceptionCoreTb>(message); m_MonitorClient.SendExceptionMessage(ab); File.Delete(failureFiles[i]); } } //--检测调用队列,并重新发送 String[] invokeQueue = Directory.GetFiles(m_InvokeQueuePath); if (invokeQueue.Length > 0) { for (int i = 0; i < invokeQueue.Length; i++) { String message = File.ReadAllText(invokeQueue[i]); QueueMessage qm = XmlUtil.LoadObjFromXML <QueueMessage>(message); m_MonitorClient.SendToInvokeQueue(qm); File.Delete(invokeQueue[i]); } } } }
/// <summary> /// 抛出异常并写日志, 并需要记录异常的时间 /// </summary> /// <param name="message"></param> /// <param name="binding"></param> /// <param name="request"></param> public static Exception ExceptionAndLog(CallState state, String exceptionDesc, String message, BindingTemplate binding, ESB.Core.Schema.服务请求 request) { String messageID = String.Empty; String exceptionMessage = String.Format("{0}:{1}", exceptionDesc, message); if (state.CallBeginTime.Year != DateTime.Now.Year) state.CallBeginTime = DateTime.Now; if (state.CallEndTime.Year != DateTime.Now.Year) state.CallEndTime = DateTime.Now; if (binding != null) messageID = AddAuditLog(0, binding, state , exceptionMessage, request); else messageID = AddAuditLog(0, "00000000-0000-0000-0000-000000000000" , String.Empty, string.Empty, state, exceptionMessage, request); ExceptionCoreTb exception = new ExceptionCoreTb() { ExceptionID = Guid.NewGuid().ToString(), BindingTemplateID = binding == null ? "" : binding.TemplateID, BindingType = 0, Description = exceptionDesc, ExceptionCode = String.Empty, ExceptionInfo = exceptionMessage, ExceptionLevel = 0, ExceptionStatus = 0, ExceptionTime = DateTime.Now, ExceptionType = 0, HostName = request.主机名称, MessageBody = request.消息内容, MessageID = messageID, MethodName = request.方法名称, RequestPwd = request.密码, RequestType = 0 }; //exception.Insert(); ESBProxy.GetInstance().MessageQueueClient.SendExceptionMessage(exception); return new Exception(message); }
public void DeleteExceptionByID(String exceptionID) { ExceptionCoreTb.FindByExceptionID(exceptionID).Delete(); }
public ExceptionCoreTb GetExceptionByID(String exceptionID) { return(ExceptionCoreTb.FindByExceptionID(exceptionID)); }
/// <summary> /// 发送异常消息 /// </summary> public void SendExceptionMessage(ExceptionCoreTb exception) { SendMessage <ExceptionCoreTb>(Constant.ESB_EXCEPTION_QUEUE, exception); }