public bool Handle(OrderTaken message)
        {
            _topicDispatcher.Unsubscribe(message.GetType().FullName, this);

            _topicDispatcher.Subscribe(message.CorrelationId.ToString(), new Printer());

            return(true);
        }
Beispiel #2
0
        public bool Handle(OrderTaken message)
        {
            if (_finished)
            {
                return(true);
            }

            _topicDispatcher.Subscribe(message.CorrelationId.ToString(), new Printer());
            _finished = true;
            return(true);
        }
        private void AddNewOrderFulfillment(OrderTaken message)
        {
            IProcessManager orderFulfillment;

            if (!_processes.TryGetValue(message.CorrelationId, out orderFulfillment))
            {
                if (message.Order.DodgeyCustomer)
                {
                    orderFulfillment = new OrderFulfillmentForDodgeyCustomer(_dispatcher, message);
                }
                else
                {
                    orderFulfillment = new OrderFulfillment(_dispatcher, message);
                }
                _processes.Add(message.CorrelationId, orderFulfillment);
                _dispatcher.Subscribe <IMessage>(message.CorrelationId.ToString(), this);
            }
        }