示例#1
0
        Message CreateAckMessage(HttpStatusCode statusCode, string statusDescription)
        {
            Message ackMessage = new NullMessage();
            HttpResponseMessageProperty httpResponseProperty = new HttpResponseMessageProperty();

            httpResponseProperty.StatusCode         = statusCode;
            httpResponseProperty.SuppressEntityBody = true;
            if (statusDescription.Length > 0)
            {
                httpResponseProperty.StatusDescription = statusDescription;
            }

            ackMessage.Properties.Add(HttpResponseMessageProperty.Name, httpResponseProperty);

            return(ackMessage);
        }
示例#2
0
        public override Message CreateMessage()
        {
            if (closed)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateBufferDisposedException());
            }

            Message msg;

            if (isNullMessage)
            {
                msg = new NullMessage();
            }
            else
            {
                msg = Message.CreateMessage(msgBuffer.GetReader(0), int.MaxValue, version);
            }

            lock (ThisLock)
            {
                msg.Properties.CopyProperties(properties);
            }

            for (int i = 0; i < understoodHeaders.Length; ++i)
            {
                if (understoodHeaders[i])
                {
                    msg.Headers.AddUnderstood(i);
                }
            }

            if (to != null)
            {
                msg.Headers.To = to;
            }

            if (action != null)
            {
                msg.Headers.Action = action;
            }

            return(msg);
        }