Ejemplo n.º 1
0
        /// <summary>
        /// Checks if this message is the only or final message in response to a request.
        /// </summary>
        /// <param name="header">The message header.</param>
        /// <param name="version">The ETP version.</param>
        /// <returns><c>true</c> if this is an acknowledge message with NoData set,
        /// a protocol exception, or a different message type that is either the final
        /// part of a multi-part message or not part of a multi-part message;
        /// <c>false</c> otherwise.</returns>
        public static bool IsFinalResponse(this IMessageHeader header, EtpVersion version)
        {
            if (!header.HasCorrelationId())
            {
                return(false);
            }

            if (version == EtpVersion.v11)
            {
                if (header.IsAcknowledge() && header.IsNoData())
                {
                    return(true);
                }

                if (header.IsProtocolException())
                {
                    return(true);
                }

                return(!header.IsMultiPart() || header.IsFinalPart());
            }
            else
            {
                return(header.IsFinalPart());
            }
        }