public bool Consume(OrderPriced message) { TopicPubSub.Instance.Publish(Topics.Payment, new OrderReadyForPayment { Order = message.Order }); return(true); }
public void Handle(OrderPriced m) { _dispatcher.Publish(new TakePayment(m) { Order = m.Order }); }
private void HandleInternal(OrderPriced message) { this.publisher.Publish(new TakePayment(message) { Order = message.Order }); }
public void after_orderPriced_then_takePayment() { // given var d = new FakeDispatcher(); var m = new Runner(d); var o = new Order { OrderId = Guid.NewGuid() }; // when var inputEvent = new OrderPriced { Order = o }; m.Handle(inputEvent); // then Assert.Single(d.Messages); Assert.IsType <TakePayment>(d.Messages[0]); var x0 = d.Messages[0] as TakePayment; Assert.Equal(o.OrderId, x0.Order.OrderId); Assert.Equal(inputEvent.CorrelationId, x0.CorrelationId); Assert.Equal(inputEvent.MessageId, x0.ParentId); }
public void Handle(OrderPriced message) { _bus.Publish(new TakePayment(message.Order) { CorrelationId = message.CorrelationId, CausationId = message.MessageId }); }
public void WhenMidgetNotifiedOfOrderPriced_ThenMidgetSendsCommandToTakePayment() { var orderPriced = new OrderPriced(order, Guid.NewGuid(), orderGuid); var midget = new EnglishMidget(bus, orderGuid); midget.Handle(orderPriced); Assert.That(bus.Messages.Single(), Is.InstanceOf<TakePayment>()); }
public void WhenMidgetNotifiedOfOrderPriced_ThenMidgetSendsCommandToTakePayment() { var orderPriced = new OrderPriced(order, Guid.NewGuid(), orderGuid); var midget = new EnglishMidget(bus, orderGuid); midget.Handle(orderPriced); Assert.That(bus.Messages.Single(), Is.InstanceOf <TakePayment>()); }
public void Handle(OrderPriced order) { var message = new TakePayment { Order = order.Order }; message.ReplyTo(order); _publisher.Publish(message); }
public void Handle(OrderPriced message) { var payForOrder = new PayForOrder(message.Order) { MessageId = Guid.NewGuid(), CorrelationId = message.CorrelationId, CausationId = message.MessageId }; _bus.Publish(payForOrder); }
public void Handle(OrderPriced message) { if (message == null) { return; } _publisher.Publish(new TakePayment() { CorrelationId = message.CorrelationId, CausationId = message.EventId, Order = message.Order }); }
public void Handle(OrderPriced message) { if (_expectedNextCausationId == message.CausationId) { var payForOrder = new PayForOrder(message.Order) { MessageId = Guid.NewGuid(), CorrelationId = message.CorrelationId, CausationId = message.MessageId }; _expectedNextCausationId = payForOrder.MessageId; _bus.Publish(payForOrder); } else { Console.WriteLine("Received Evil Message: Order Priced {0}", message.Order.Id); } }
public void Handle(PriceOrder message) { var order = message.Order; Console.WriteLine("Pricing..."); order.LineItems.ForEach(item => order = order.SetLinePrice(item.Id, 5.10m)); var subTotal = order.LineItems.Sum(x => x.Price); var tax = subTotal * 0.1m; order = order.SetTax(tax) .SetTotal(tax + subTotal); var @event = new OrderPriced { Order = order }; @event.CorrelationId = message.CorrelationId; @event.CausationId = message.Id; _bus.Publish(@event); }
public void Handle(OrderPriced message) { _orderStatuses[message.Order.Id] = OrderStatus.Priced; }
public void Handle(OrderPriced message) { Console.WriteLine(message.CorrelationId); Console.WriteLine(message.GetType()); Console.WriteLine(message.Order); }