Exemple #1
0
 public InvoiceConfirmationService(
     InvoiceConfirmationPublisher invoiceConfirmationPublisher,
     RetryPolicySettings retryPolicySettings,
     ILogFactory logFactory)
 {
     _invoiceConfirmationPublisher = invoiceConfirmationPublisher;
     _log         = logFactory.CreateLog(this);
     _retryPolicy = Policy
                    .Handle <Exception>()
                    .WaitAndRetryAsync(
         retryPolicySettings.DefaultAttempts,
         attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)),
         (ex, timespan) => _log.Error(ex, "Publish confirmations to callback with retry"));
 }
 public ConfirmationsService(
     [NotNull] InvoiceConfirmationPublisher invoiceConfirmationPublisher,
     [NotNull] RetryPolicySettings retryPolicySettings,
     [NotNull] ILogFactory logFactory)
 {
     _invoiceConfirmationPublisher = invoiceConfirmationPublisher ?? throw new ArgumentNullException(nameof(invoiceConfirmationPublisher));
     _retryPolicySettings          = retryPolicySettings ?? throw new ArgumentNullException(nameof(retryPolicySettings));
     _log         = logFactory.CreateLog(this);
     _retryPolicy = Policy
                    .Handle <Exception>()
                    .WaitAndRetryAsync(
         _retryPolicySettings.DefaultAttempts,
         attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)),
         (ex, timespan) => _log.Error(ex, "Publish invoice confirmation with retry"));
 }