Exemplo n.º 1
0
        /// <summary>
        /// Decodes the message based on the message type contained in the specified <see cref="IMessageHeader" />.
        /// </summary>
        /// <param name="header">The message header.</param>
        /// <param name="body">The message body.</param>
        public void HandleMessage(IMessageHeader header, ISpecificRecord body)
        {
            if (!InvokeMessageHandler(header, body))
            {
                this.InvalidMessage(header);
            }

            // Additional processing if this message was the final message in response to a request:
            if (header.IsFinalResponse())
            {
                HandleFinalResponse(header.CorrelationId);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Decodes the message based on the message type contained in the specified <see cref="IMessageHeader" />.
        /// </summary>
        /// <param name="header">The message header.</param>
        /// <param name="decoder">The message decoder.</param>
        /// <param name="body">The message body.</param>
        protected virtual void HandleMessage(IMessageHeader header, Decoder decoder, string body)
        {
            switch (header.MessageType)
            {
            case (int)v11.MessageTypes.Core.ProtocolException:
                HandleProtocolException(header, Session.Adapter.DecodeProtocolException(decoder, body));
                break;

            case (int)v11.MessageTypes.Core.Acknowledge:
                HandleAcknowledge(header, Session.Adapter.DecodeAcknowledge(decoder, body));
                break;

            default:
                this.InvalidMessage(header);
                break;
            }

            // Additional processing if this message was the final message in response to a request:
            if (header.IsFinalResponse())
            {
                HandleFinalResponse(header.CorrelationId);
            }
        }