public void PublishToProjection(UpdatePriceCommand updatePriceCommand) { Thread.Sleep(3000); if(!ProductProjections.ProductRepo.ContainsKey(updatePriceCommand.ProductId)) return; var product = ProductProjections.ProductRepo[updatePriceCommand.ProductId]; product.Price = updatePriceCommand.NewPrice; ProductProjections.ProductRepo[updatePriceCommand.ProductId] = product; }
public AjaxContinuation Post(UpdatePriceCommand updatePriceCommand) { Thread.Sleep(5000); var commandHandler = new CQRS.UpdatePriceCommandHandler(); updatePriceCommand.CommandId = Guid.NewGuid(); commandHandler.Publish(updatePriceCommand); var continuation = AjaxContinuation.Successful(); return continuation; }
public void Publish(UpdatePriceCommand updatePriceCommand) { EventRepo.Add(updatePriceCommand.CommandId, updatePriceCommand); ThreadPool.QueueUserWorkItem(x => PublishToProjection(updatePriceCommand)); }