private TimeSpan CustomRetryPolicy(TransportMessage message) { // Stop second level retries in case of a business exception if (BusinessLogicExceptionTypes.Contains(message.ExceptionType())) { Console.WriteLine("Dropping Slr for message '{0}'", message.Id); return TimeSpan.MinValue; } return TimeSpan.FromSeconds(10); }
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); }