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); }
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); }