Skip to content

Instantly share code, notes, and snippets.

@chester89
Created June 6, 2017 13:30
Show Gist options
  • Save chester89/2a323372b0ae9410478a63e00bf92c7b to your computer and use it in GitHub Desktop.
Save chester89/2a323372b0ae9410478a63e00bf92c7b to your computer and use it in GitHub Desktop.
RetryClient
RestClient client = new RestClient();
RestRequest request = new RestRequest();
request.AddParameter("domain", domain, ParameterType.UrlSegment);
request.Resource = "{domain}/messages";
request.AddParameter("from", sender);
request.AddParameter("to", sendTo);
request.AddParameter("subject", "...");
request.AddParameter("text", "...");
request.Method = Method.POST;
var response = backoffStrategy.RetryOnOperationResult(attempt => client.Execute(request), 50,
tempResponse => tempResponse.StatusCode != HttpStatusCode.Accepted && tempResponse.StatusCode != HttpStatusCode.OK);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment