Skip to content

Instantly share code, notes, and snippets.

View RescheduleStrategy.cs
public class RescheduleStrategy
{
private const string RetryAttemptPropertyName = "retry-attempt";
private const int MaxRetryAttempts = 5;
private const int Exponent = 2;
private readonly Random _random = new Random();
private readonly IQueueClient _queueClientImplementation;
private readonly TimeSpan _initialDelay = TimeSpan.FromSeconds(5);
public async Task ScheduleRetryAsync(Message message)
View CircuitBreakerHandler.cs
using Polly;
using Polly.CircuitBreaker;
public class CircuitBreakerHandler
{
private readonly IEmailService _emailService;
private readonly ILogger _logger;
private CircuitBreakerPolicy _circuitBreaker;
public CircuitBreakerHandler(IEmailService emailService, ILogger logger)
View FireAndForgetHandler.cs
public class FireAndForgetHandler
{
private readonly IEmailService _emailService;
private readonly ILogger _logger;
public FireAndForgetHandler(IEmailService emailService, ILogger logger)
{
_emailService = emailService;
_logger = logger;
}