Пример #1
0
        /// <summary>
        /// Method that can be used by the message handlers to check if a message has inner messages to process (and process them)
        /// </summary>
        /// <param name="originalMessage">The message that the handler successfully processed</param>
        public void CheckChainedMessages(Message originalMessage, Dictionary<string,object> additionalInfo=null)
        {
            ASSERT( originalMessage != null, "Missing parameter 'originalMessage'" );

            object obj;
            if(! originalMessage.TryGetValue(Message.KeyMessageChainedMessages, out obj) )
                // Nothing chained
                return;

            var list = (IEnumerable)obj;
            foreach( var item in list )
            {
                var chainedMessage = Message.CreateReceivedMessage( originalMessage.SenderConnectionID, (IDictionary<string,object>)item );

                if( additionalInfo != null )
                {
                    foreach( var pair in additionalInfo )
                        chainedMessage[ pair.Key ] = pair.Value;
                }

                ReceiveMessage( chainedMessage );
            }
        }