Example #1
0
        public async Task Handle(ActivateAccountSecuredOperationCreatedDomainEvent @event,
                                 CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.SendAsync(new SendActivateAccountMessageIntegrationCommand(@event.Request,
                                                                                                    @event.Email, @event.Username, @event.Token, @event.Endpoint), cancellationToken);

            await _massTransitBusService.PublishAsync(
                new ActivateAccountSecuredOperationCreatedIntegrationEvent(@event.Request.Id, @event.UserId,
                                                                           @event.OperationId, $"Successfully created secured operation for user with id: {@event.UserId}."),
                cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
Example #2
0
        public async Task Handle(ResetPasswordInitiatedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            var operation = await _oneTimeSecuredOperationService.GetAsync(@event.OperationId);

            await _massTransitBusService.PublishAsync(
                new ResetPasswordInitiatedIntegrationEvent(@event.Request.Id, @event.OperationId, @event.Email,
                                                           @event.Endpoint,
                                                           $"Reset password for user with email: {@event.Email} initiated."),
                cancellationToken);

            await _massTransitBusService.SendAsync(
                new SendResetPasswordMessageIntegrationCommand(@event.Request, @event.Email, operation.Token,
                                                               @event.Endpoint), cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }