public Task Handle(GoodsInStockEvent message, IMessageHandlerContext context) { var checkCustomerPaymentHistory = new CheckCustomerPaymentHistoryCommand { CartId = message.CartId, CustomerId = Data.CustomerId }; return(context.Send(checkCustomerPaymentHistory)); }
public Task Handle(CheckGoodsInStockCommand message, IMessageHandlerContext context) { //TODO: actual business logic goes here //randomly return negative events if (random.Next(0, 5) == 0) { var goodsNotInStock = new GoodsNotInStockEvent { CartId = message.CartId }; return(context.Publish(goodsNotInStock)); } var goodsInStock = new GoodsInStockEvent { CartId = message.CartId }; return(context.Publish(goodsInStock)); }