static TimeSpan MyCustomRetryPolicy(TransportMessage transportMessage)
        {
            var numberOfRetries = transportMessage.NumberOfRetries();
            var exceptionType   = transportMessage.ExceptionType();

            // perform some logic and decide when to retry
            return(TimeSpan.FromSeconds(5));
        }
Пример #2
0
        TimeSpan MyCustomRetryPolicy(TransportMessage transportMessage)
        {
            // retry max 3 times
            if (transportMessage.NumberOfRetries() >= 3)
            {
                // sending back a TimeSpan.MinValue tells the
                // SecondLevelRetry not to retry this message
                return(TimeSpan.MinValue);
            }

            return(TimeSpan.FromSeconds(5));
        }
Пример #3
0
        TimeSpan MyCustomRetryPolicy(TransportMessage transportMessage)
        {
            if (transportMessage.ExceptionType() == typeof(MyBusinessException).FullName)
            {
                // Do not retry for MyBusinessException
                return(TimeSpan.MinValue);
            }

            if (transportMessage.NumberOfRetries() >= 3)
            {
                return(TimeSpan.MinValue);
            }

            return(TimeSpan.FromSeconds(5));
        }