protected override Task On(UserCreated @event, CancellationToken cancellationToken) { if (@event == default) { throw new ArgumentNullException(nameof(@event)); } _singletonValueContainer.SumTotal(); return(Task.CompletedTask); }
protected override Task On(UserCreated @event, CancellationToken cancellationToken) { if (@event == default) { throw new ArgumentNullException(nameof(@event)); } var rnd = new Random(); var random = rnd.Next(1, 15); if (random == 2) { throw new Exception("To retry"); } if (_httpContextAccessor?.HttpContext?.User.Claims.Any(e => e.Type == "Name" && e.Value == "Peter") == true) { _singletonValueContainer.SumTotal(); } return(Task.CompletedTask); }