private bool HandledMaxRetries(TransportMessage message)
        {
            string messageId = message.Id;

            failuresPerMessageLocker.EnterReadLock();

            if (failuresPerMessage.ContainsKey(messageId) &&
                (failuresPerMessage[messageId] >= maxRetries))
            {
                failuresPerMessageLocker.ExitReadLock();
                failuresPerMessageLocker.EnterWriteLock();

                var ex = exceptionsForMessages[messageId];
                FailureManager.ProcessingAlwaysFailsForMessage(message, ex);

                failuresPerMessage.Remove(messageId);
                exceptionsForMessages.Remove(messageId);

                failuresPerMessageLocker.ExitWriteLock();

                return(true);
            }

            failuresPerMessageLocker.ExitReadLock();
            return(false);
        }
Example #2
0
 void InvokeFaultManager(TransportMessage message, Exception exception)
 {
     try
     {
         FailureManager.ProcessingAlwaysFailsForMessage(message, exception);
     }
     catch (Exception ex)
     {
         Logger.FatalFormat("Fault manager failed to process the failed message {0}", ex, message);
         Configure.Instance.OnCriticalError();
     }
 }