/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// </summary> /// <param name="code">The error code.</param> /// <param name="e">The exception, or null.</param> /// <returns>The logged message.</returns> protected string LogMessageQueueException(MessageQueueErrorCode code, Exception e) { TraceEventType logType = TraceEventType.Error; string errorMsg = string.Empty; if (code == MessageQueueErrorCode.TransactionUsage) { errorMsg = string.Format(CultureInfo.CurrentCulture, Resources.MsmqInvalidTransactionUsage, msmqPath); } else if (code == MessageQueueErrorCode.IOTimeout) { errorMsg = string.Format(CultureInfo.CurrentCulture, Resources.MsmqReceiveTimeout, msmqPath); logType = TraceEventType.Warning; } else if (code == MessageQueueErrorCode.AccessDenied) { errorMsg = string.Format(CultureInfo.CurrentCulture, Resources.MsmqAccessDenied, msmqPath, WindowsIdentity.GetCurrent().Name); } else { errorMsg = string.Format(CultureInfo.CurrentCulture, Resources.MsmqReceiveError, msmqPath); } this.eventLogger.LogServiceFailure( errorMsg, e, logType); return(errorMsg); }
/// <summary> /// map MessageQueueErrorCode to BrokerQueueErrorCode. /// </summary> /// <param name="e">the MessageQueueErrorCode.</param> /// <returns>the BrokerQueueErrorCode.</returns> public static BrokerQueueErrorCode MapToBrokerQueueErrorCode(MessageQueueErrorCode mqError) { BrokerQueueErrorCode errorCode = BrokerQueueErrorCode.E_BQ_UNKOWN_ERROR; switch (mqError) { case MessageQueueErrorCode.InsufficientResources: errorCode = BrokerQueueErrorCode.E_BQ_PERSIST_STORAGE_INSUFFICIENT; break; case MessageQueueErrorCode.MessageStorageFailed: errorCode = BrokerQueueErrorCode.E_BQ_PERSIST_STORAGE_FAIL; break; case MessageQueueErrorCode.IOTimeout: errorCode = BrokerQueueErrorCode.E_BQ_PERSIST_OPERATION_TIMEOUT; break; case MessageQueueErrorCode.ServiceNotAvailable: errorCode = BrokerQueueErrorCode.E_BQ_PERSIST_STORAGE_NOTAVAILABLE; break; } return(errorCode); }
protected string LogMessageQueueException(MessageQueueErrorCode code, Exception e) { Severity logType = Severity.Error; string errorMsg = string.Empty; string msmqPath = GetMsmqPath(); if (code == MessageQueueErrorCode.TransactionUsage) { errorMsg = SR.MsmqInvalidTransactionUsage(msmqPath); this.eventLogger.AddMessage(Header, SR.MsmqInvalidTransactionUsage(msmqPath)); } else if (code == MessageQueueErrorCode.IOTimeout) { errorMsg = SR.MsmqReceiveTimeout(msmqPath); this.eventLogger.AddMessage(Header, SR.MsmqReceiveTimeout(msmqPath)); logType = Severity.Warning; } else if (code == MessageQueueErrorCode.AccessDenied) { errorMsg = SR.MsmqAccessDenied(msmqPath, WindowsIdentity.GetCurrent().Name); this.eventLogger.AddMessage(Header, errorMsg); } else { errorMsg = SR.MsmqReceiveError(msmqPath); this.eventLogger.AddMessage(Header, errorMsg); } this.eventLogger.WriteToLog(e, logType); return(errorMsg); }
public void LogMsgQueueException(MessageQueueErrorCode code) { // a better approach would be to derive a new Exception type from // MessagequeueException and then throw it using a mock MessageQueue // However, this exception is protected and we cannot created a derived type base.LogMessageQueueException(code, new Exception("simulated exception")); }
public WorkflowOperationFault(MessageQueueErrorCode errorCode) { if (errorCode == MessageQueueErrorCode.QueueNotAvailable) { faultCode = FaultCode.CreateSenderFaultCode(operationNotAvailable, ContextMessageHeader.ContextHeaderNamespace); faultReason = new FaultReason(new FaultReasonText(SR2.GetString(SR2.OperationNotAvailable), CultureInfo.CurrentCulture)); } else { faultCode = FaultCode.CreateSenderFaultCode(operationNotImplemented, ContextMessageHeader.ContextHeaderNamespace); faultReason = new FaultReason(new FaultReasonText(SR2.GetString(SR2.OperationNotImplemented), CultureInfo.CurrentCulture)); } }
public void When_peeking_and_there_is_no_message_should_get_the_perfect_code() { IAsyncResult asyncResult = queue.BeginPeek( TimeSpan.FromMilliseconds(1), null, delegate { }); asyncResult.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(30), false); Assert.False(asyncResult.CompletedSynchronously); MessageQueueErrorCode errorCode = 0; try { queue.EndPeek(asyncResult); Assert.False(true, "should not get this"); } catch (MessageQueueException e) { errorCode = e.MessageQueueErrorCode; } Assert.Equal(MessageQueueErrorCode.IOTimeout, errorCode); }
protected MessageQueueException (SerializationInfo info, StreamingContext context) : base(info, context) { _messageQueueErrorCode = (MessageQueueErrorCode) info.GetInt32 ("NativeErrorCode"); }
internal MessageQueueException(MessageQueueErrorCode messageQueueErrorCode) : this (messageQueueErrorCode, "UnknownError") { }
internal MessageQueueException(MessageQueueErrorCode messageQueueErrorCode, String message) : base (message) { _messageQueueErrorCode = messageQueueErrorCode; }
public QueueException(string message, MessageQueueErrorCode errorCode) : base(message) { this.errorCode = errorCode; }
internal MessageQueueException(MessageQueueErrorCode messageQueueErrorCode) : this(messageQueueErrorCode, "UnknownError") { }
internal MessageQueueException(MessageQueueErrorCode messageQueueErrorCode, String message) : base(message) { _messageQueueErrorCode = messageQueueErrorCode; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// </summary> /// <param name="code">The error code.</param> /// <param name="e">The exception, or null.</param> /// <returns>The logged message.</returns> protected string LogMessageQueueException(MessageQueueErrorCode code, Exception e) { TraceEventType logType = TraceEventType.Error; string errorMsg = string.Empty; if (code == MessageQueueErrorCode.TransactionUsage) { errorMsg = string.Format(Resources.Culture, Resources.MsmqInvalidTransactionUsage, msmqPath); } else if (code == MessageQueueErrorCode.IOTimeout) { errorMsg = string.Format(Resources.Culture, Resources.MsmqReceiveTimeout, msmqPath); logType = TraceEventType.Warning; } else if (code == MessageQueueErrorCode.AccessDenied) { errorMsg = string.Format(Resources.Culture, Resources.MsmqAccessDenied, msmqPath, WindowsIdentity.GetCurrent().Name); } else { errorMsg = string.Format(Resources.Culture, Resources.MsmqReceiveError, msmqPath); } this.eventLogger.LogServiceFailure( errorMsg, e, logType); return errorMsg; }
protected string LogMessageQueueException(MessageQueueErrorCode code, Exception e) { Severity logType = Severity.Error; string errorMsg = string.Empty; string msmqPath = GetMsmqPath(); if (code == MessageQueueErrorCode.TransactionUsage) { errorMsg = SR.MsmqInvalidTransactionUsage(msmqPath); this.eventLogger.AddMessage(Header, SR.MsmqInvalidTransactionUsage(msmqPath)); } else if (code == MessageQueueErrorCode.IOTimeout) { errorMsg = SR.MsmqReceiveTimeout(msmqPath); this.eventLogger.AddMessage(Header, SR.MsmqReceiveTimeout(msmqPath)); logType = Severity.Warning; } else if (code == MessageQueueErrorCode.AccessDenied) { errorMsg = SR.MsmqAccessDenied(msmqPath, WindowsIdentity.GetCurrent().Name); this.eventLogger.AddMessage(Header, errorMsg); } else { errorMsg = SR.MsmqReceiveError(msmqPath); this.eventLogger.AddMessage(Header, errorMsg); } this.eventLogger.WriteToLog(e, logType); return errorMsg; }
internal MessageQueueException(MessageQueueErrorCode messageQueueErrorCode) { _messageQueueErrorCode = messageQueueErrorCode; }
protected MessageQueueException(SerializationInfo info, StreamingContext context) : base(info, context) { _messageQueueErrorCode = (MessageQueueErrorCode)info.GetInt32("NativeErrorCode"); }