public Task HandleAsync(
     OrderStatusChangedToShippedIntegrationEvent integrationEvent)
 {
     // Save the updated status in the read model and notify the client via SignalR.
     return(UpdateReadModelAndSendNotificationAsync(integrationEvent.OrderId,
                                                    integrationEvent.OrderStatus, integrationEvent.Description, integrationEvent.BuyerId));
 }
        public async Task Handle(OrderShippedDomainEvent orderShippedDomainEvent, CancellationToken cancellationToken)
        {
            var order = await _orderRepository.GetAsync(orderShippedDomainEvent.Order.Id);

            var buyer = await _buyerRepository.FindByIdAsync(order.GetBuyerId.Value.ToString());

            var orderStatusChangedToShippedIntegrationEvent = new OrderStatusChangedToShippedIntegrationEvent(order.Id, order.OrderStatus.Name, buyer.Name);
            await _messageOutbox.Send(orderStatusChangedToShippedIntegrationEvent);
        }
        public async Task Handle(OrderShippedDomainEvent orderShippedDomainEvent, CancellationToken cancellationToken)
        {
            _logger.CreateLogger(nameof(OrderShippedDomainEvent))
            .LogTrace($"Order with Id: {orderShippedDomainEvent.Order.Id} has been successfully updated with " +
                      $"a status order id: {OrderStatus.Shipped.Id}");

            var order = await _orderRepository.GetAsync(orderShippedDomainEvent.Order.Id);

            var buyer = await _buyerRepository.FindByIdAsync(order.GetBuyerId.Value.ToString());

            var orderStatusChangedToShippedIntegrationEvent = new OrderStatusChangedToShippedIntegrationEvent(order.Id, order.OrderStatus.Name, buyer.Name);
            await _orderingIntegrationEventService.PublishThroughEventBusAsync(orderStatusChangedToShippedIntegrationEvent);
        }
        public async Task Handle(OrderShippedDomainEvent orderShippedDomainEvent, CancellationToken cancellationToken)
        {
            _logger.CreateLogger <OrderShippedDomainEvent>()
            .LogTrace("Order with Id: {OrderId} has been successfully updated to status {Status} ({Id})",
                      orderShippedDomainEvent.Order.Id, nameof(OrderStatus.Shipped), OrderStatus.Shipped.Id);

            var order = await _orderRepository.GetAsync(orderShippedDomainEvent.Order.Id);

            var buyer = await _buyerRepository.FindByIdAsync(order.GetBuyerId.Value.ToString());

            var orderStatusChangedToShippedIntegrationEvent = new OrderStatusChangedToShippedIntegrationEvent(order.Id, order.OrderStatus.Name, buyer.Name);
            await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedToShippedIntegrationEvent);
        }
Esempio n. 5
0
 public async Task OrderStarted(OrderStatusChangedToShippedIntegrationEvent @event)
 {
     var handler = _serviceProvider.GetRequiredService <OrderStatusChangedToShippedIntegrationEventHandler>();
     await handler.Handle(@event);
 }