public void AvailabilityQuoteShouldBeReceived() { long deliveryId = 1; string partnerId = "1"; string productId = "1"; decimal quantity = 1; IActorRef availabilityQuoteAgentActor = Sys.ActorOf(Props.Create <AvailabilityQuoteAgentActor>(partnerId), $"availability-quote-agent-{ partnerId }"); var deliverAtLeastOnce = new DeliverAtLeastOnce <RequestAvailabilityQuote>(deliveryId, new RequestAvailabilityQuote(productId, quantity)); availabilityQuoteAgentActor.Tell(deliverAtLeastOnce); AtLeastOnceDelivered atLeastOnceDelivered = ExpectMsg <AtLeastOnceDelivered>(message => message.DeliveryId == deliveryId); ResponseAvailabilityQuote responseAvailabilityQuote = ExpectMsg <ResponseAvailabilityQuote>( message => message.PartnerId == partnerId && message.ProductId == productId && message.AvailabilityQuotes.Count( availabilityQuote => availabilityQuote.ExpiryDate == DateTime.Today && availabilityQuote.Quantity == quantity ) == 1 ); }
private void ProcessRetailSale(DeliverAtLeastOnce <ProcessRetailSale> deliverAtLeastOnce) { logger.Info("Process retail sale (Id: {0})", deliverAtLeastOnce.Message.Id); Sender.Tell(new AtLeastOnceDelivered(deliverAtLeastOnce.DeliveryId)); string processId = string.Empty; IActorRef processActor = Context.ActorOf(Context.DI().Props <RetailSaleProcessActor>(), $"retail-sale-process-{ processId }"); CreateProcess(processId, processActor); }
private void RequestAvailabilityQuote(DeliverAtLeastOnce <RequestAvailabilityQuote> deliverAtLeastOnce) { logger.Info("Request availability quote (ProductId: {0}, Quantity {1})", deliverAtLeastOnce.Message.ProductId, deliverAtLeastOnce.Message.Quantity); var atLeastOnceDelivered = new AtLeastOnceDelivered(deliverAtLeastOnce.DeliveryId); Sender.Tell(atLeastOnceDelivered); var availabilityQuotes = new HashSet <AvailabilityQuote>() { new AvailabilityQuote(DateTime.Today, deliverAtLeastOnce.Message.Quantity) }; var responseAvailabilityQuote = new ResponseAvailabilityQuote(deliverAtLeastOnce.Message.ProductId, PartnerId, availabilityQuotes); Sender.Tell(responseAvailabilityQuote); }