public Task Timeout(BuyersRemorseTimeout state, IMessageHandlerContext context) { context.Publish <IOrderPlaced>( o => { o.OrderId = Data.OrderId; o.TotalValue = Data.TotalValue; }); MarkAsComplete(); return(Task.CompletedTask); }
// ----------------------- Timeouts ----------------------- public void Timeout(BuyersRemorseTimeout state) { // if the order is no longer around, it was cancelled if (!Data.Orders.Any(o => o.Id == state.OrderId)) { return; } // complete the order Bus.Publish <OrderCompleted>(o => { o.CustomerId = state.CustomerId; o.OrderId = state.OrderId; o.ProductId = state.ProductId; o.Amount = state.Amount; o.DateOccurred = DateTime.Now; }); Console.WriteLine("------------------"); Console.WriteLine("Order Completed: " + state.OrderId + " " + state.CustomerId + " " + state.ProductId + " " + state.Amount + " after " + (state.DiscountApplied * 100) + "% discount"); PrintBalance(); Console.WriteLine("------------------"); }