Skip to content

Instantly share code, notes, and snippets.

@andreasohlund
Created September 25, 2012 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreasohlund/3781308 to your computer and use it in GitHub Desktop.
Save andreasohlund/3781308 to your computer and use it in GitHub Desktop.
How to turn SLR of for a given exception type
public class ChangeRetryPolicy : INeedInitialization
{
public void Init()
{
SecondLevelRetries.RetryPolicy = (tm) =>
{
// retry max 3 times
if (TransportMessageHelpers.GetNumberOfRetries(tm) >= 3)
{
// To send back a value less than zero tells the
// SecondLevelRetry satellite not to retry this message
// anymore.
return TimeSpan.MinValue;
}
if (tm.Headers["NServiceBus.ExceptionInfo.ExceptionType"] == typeof(MyBusinessException).FullName)
return TimeSpan.MinValue;
return TimeSpan.FromSeconds(5);
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment