Skip to content

Instantly share code, notes, and snippets.

@AndrewAllison
Created September 30, 2020 09:50
Show Gist options
  • Save AndrewAllison/e05c55af7e75c85a3fd20477a89e0656 to your computer and use it in GitHub Desktop.
Save AndrewAllison/e05c55af7e75c85a3fd20477a89e0656 to your computer and use it in GitHub Desktop.
Using Polly lib with C# For retries.
var processingPolicy = Policy
.Handle<SageLockingException>()
.Or<SageProductException>()
.WaitAndRetry(delay, onRetry: (exception, timeSpan, context) =>
{
HandleException(result, orderToProcess, exception);
});
var orderResults = processingPolicy.Execute(() => sageOrderHandler.ProcessNewOrder(sageOrder));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment