public Task Handle(GoodsInStockEvent message, IMessageHandlerContext context) { var checkCustomerPaymentHistory = new CheckCustomerPaymentHistoryCommand { CartId = message.CartId, CustomerId = Data.CustomerId }; return(context.Send(checkCustomerPaymentHistory)); }
public Task Handle(CheckCustomerPaymentHistoryCommand message, IMessageHandlerContext context) { //TODO: acutal business logic goes here var random = new Random(); //randomly return negative events if (random.Next(0, 5) == 0) { var paymentHistoryNegative = new PaymentHistoryNegativeEvent { CartId = message.CartId }; return(context.Publish(paymentHistoryNegative)); } var paymentHistoryPositive = new PaymentHistoryPositiveEvent { CartId = message.CartId }; return(context.Publish(paymentHistoryPositive)); }