/// <summary> /// This handler mimics the fact that a user actually clicked the email verification link! :-) /// </summary> public Task Handle(VerificationEmailSent message, IMessageHandlerContext context) { var secondsToWait = rnd.Next(SecondsToCompletelyTimeoutSaga); logger.Info($"Received [{message.VerificationCode}] - Waiting {secondsToWait} seconds to respond."); var sendOptions = new SendOptions(); sendOptions.DelayDeliveryWith(TimeSpan.FromSeconds(secondsToWait)); var command = new UserVerifyingEmail(message.UserId, message.VerificationCode); return(context.Send(command, sendOptions)); }
public async Task Handle(UserVerifyingEmail message, IMessageHandlerContext context) { logger.Info($"Received verification code {message.VerificationCode} for {Data.EmailAddress}"); if (message.VerificationCode == Data.VerificationCode) { logger.Info($"[{message.VerificationCode}] is correct!"); var cmd = new AddUserToSystem { UserId = Data.UserIdentifier, Name = Data.Name, EmailAddress = Data.EmailAddress }; await context.Send(cmd); MarkAsComplete(); } // If for some reason a UserVerifyingEmail message came in, but with incorrect VerificationCode, it's just ignored. }