コード例 #1
0
 public async Task HandleScheduledCommandException(CustomerAccount aggregate, CommandFailed <RequestUserName> command)
 {
     if (command.Exception is ConcurrencyException)
     {
         command.Retry(TimeSpan.Zero);
     }
 }
コード例 #2
0
        public void When_a_retry_is_pending_then_WillBeRetried_returns_true()
        {
            var failed = new CommandFailed(new ScheduledCommand<NonEventSourcedCommandTarget>(new TestCommand(), Any.Guid()));

            failed.Retry();

            failed.WillBeRetried
                  .Should()
                  .BeTrue();
        }
コード例 #3
0
        public void When_a_retry_is_pending_then_WillBeRetried_returns_true()
        {
            var failed = new CommandFailed(new ScheduledCommand <NonEventSourcedCommandTarget>(new TestCommand(), Any.Guid()));

            failed.Retry();

            failed.WillBeRetried
            .Should()
            .BeTrue();
        }
コード例 #4
0
 public async Task HandleScheduledCommandException(Order order, CommandFailed <ChargeCreditCard> command)
 {
     if (command.NumberOfPreviousAttempts < 3)
     {
         command.Retry(after: command.Command.ChargeRetryPeriod);
     }
     else
     {
         order.RecordEvent(new Cancelled
         {
             Reason = "Final credit card charge attempt failed."
         });
     }
 }