public async Task Handle(OrderStatusChangedToSubmittedIntegrationEvent integrationEvent, [FromServices] IOptions <OrderingSettings> settings, [FromServices] IEmailService emailService) { // Gets the order details from Actor state. var actorId = new ActorId(integrationEvent.OrderId.ToString()); var orderingProcess = ActorProxy.Create <IOrderingProcessActor>(actorId, nameof(OrderingProcessActor)); // var actorOrder = await orderingProcess.GetOrderDetails(); var readModelOrder = Model.Order.FromActorState(integrationEvent.OrderId, actorOrder); // Add the order to the read model so it can be queried from the API. // It may already exist if this event has been handled before (at-least-once semantics). readModelOrder = await _orderRepository.AddOrGetOrderAsync(readModelOrder); // Send a SignalR notification to the client. await SendNotificationAsync(readModelOrder.OrderNumber, integrationEvent.OrderStatus, integrationEvent.BuyerName); // Send a confirmation e-mail if enabled. if (settings.Value.SendConfirmationEmail) { await emailService.SendOrderConfirmation(readModelOrder); } }