Skip to content

Instantly share code, notes, and snippets.

@dariusjs
Created February 27, 2019 12:02
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 dariusjs/c3e6a89b3ed02ef2d68f4398747b1ca3 to your computer and use it in GitHub Desktop.
Save dariusjs/c3e6a89b3ed02ef2d68f4398747b1ca3 to your computer and use it in GitHub Desktop.
Polly Retry Policy for Kinesis Putrecord
var pollyRetryPolicy = Policy
.Handle<Exception>()
.OrResult<PutRecordResponse>(message => !message.HttpStatusCode.Equals(HttpStatusCode.OK))
.WaitAndRetryAsync(
5,
(retryAttempt) => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
(result, timeSpan, retryCount, context) => {
logger.LogError($"Kinesis Request failed with {result}. Waiting {timeSpan} before next retry. Retry attempt {retryCount}");
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment