public void Handle(OrderPaid message)
        {
            var cookOrder = new CookOrder(message.Order, DateTime.Now.AddSeconds(1000))
            {
                MessageId     = Guid.NewGuid(),
                CorrelationId = message.CorrelationId,
                CausationId   = message.MessageId
            };

            _bus.Publish(new RemindmeCommand <CookOrder>(2, cookOrder)
            {
                MessageId     = Guid.NewGuid(),
                CorrelationId = message.CorrelationId,
                CausationId   = message.MessageId
            });
            _bus.Publish(cookOrder);
        }
Esempio n. 2
0
        public UkRestaurantProcessManager(Bus bus, OrderPlaced message)
        {
            _bus           = bus;
            _correlationId = message.CorrelationId;

            OrderCookedToken     = _bus.SubscribleToCorrelationId <OrderCooked>(_correlationId, this);
            OrderPricedToken     = _bus.SubscribleToCorrelationId <OrderPriced>(_correlationId, this);
            OrderPaidToken       = _bus.SubscribleToCorrelationId <OrderPaid>(_correlationId, this);
            OrderCompletedToken  = _bus.SubscribleToCorrelationId <OrderCompleted>(_correlationId, this);
            ReminderToken        = _bus.SubscribleToCorrelationId <RememberEvent <CookOrder> >(_correlationId, this);
            OrderScrewedReminder = _bus.SubscribleToCorrelationId <RememberEvent <OrderPlaced> >(_correlationId, this);

            var cookOrder = new CookOrder(message.Order, DateTime.Now.AddSeconds(1000))
            {
                MessageId     = Guid.NewGuid(),
                CorrelationId = message.CorrelationId,
                CausationId   = message.MessageId
            };

            _expectedNextCausationId = cookOrder.MessageId;
            //_bus.Publish(new RemindmeCommand<CookOrder>(5, cookOrder)
            //{
            //    MessageId = Guid.NewGuid(),
            //    CorrelationId = message.CorrelationId,
            //    CausationId = message.MessageId
            //});

            _bus.Publish(new RemindmeCommand <OrderPlaced>(5, message)
            {
                MessageId     = Guid.NewGuid(),
                CorrelationId = message.CorrelationId,
                CausationId   = message.MessageId
            });

            _bus.Publish(cookOrder);
        }