Esempio n. 1
0
        private void ProcessResults(MessageResult result)
        {
            result.Messages.Enumerate(message => message.IsCommand || message.IsAck,
                                      message =>
            {
                if (message.IsAck)
                {
                    _ackHandler.TriggerAck(message.CommandId);
                }
                else
                {
                    var command = _serializer.Parse <Command>(message.Value);
                    ProcessCommand(command);

                    // Only send the ack if this command is waiting for it
                    if (message.WaitForAck)
                    {
                        // If we're on the same box and there's a pending ack for this command then
                        // just trip it
                        if (!_ackHandler.TriggerAck(message.CommandId))
                        {
                            _bus.Ack(_connectionId, message.Key, message.CommandId).Catch();
                        }
                    }
                }
            });
        }