Пример #1
0
        public Task Handle(SendVerificationEmail message, IMessageHandlerContext context)
        {
            logger.Info($"Received {message.UserId} - {message.VerificationCode}");

            // Integrate with SMTP server
            var @event = new VerificationEmailSent
            {
                UserId           = message.UserId,
                VerificationCode = message.VerificationCode
            };

            return(context.Publish(@event));
        }
        public async Task Handle(SendVerificationEmail message, IMessageHandlerContext context)
        {
            logger.Info($"Received {message.UserId} - {message.VerificationCode}");

            // Integrate with SMTP server
            var @event = new VerificationEmailSent
            {
                UserId           = message.UserId,
                VerificationCode = message.VerificationCode
            };

            await context.Publish(@event)
            .ConfigureAwait(false);

            if (random.Next(0, 4) == 0)
            {
                throw new InvalidOperationException("Random failure!");
            }
        }