Esempio n. 1
0
        private void SendInternal(object message, IEnumerable <string> destinations)
        {
            OutgoingHeaders[StandardHeaders.ContentType]          = MessageSerializer.ContentType;
            OutgoingHeaders[StandardHeaders.EnclosedMessageTypes] = string.Join(",", MessageMapper.GetEnclosedMessageTypes(message.GetType()).Distinct());
            if (currentMessageContext != null)
            {
                OutgoingHeaders[StandardHeaders.RelatedTo] = currentMessageContext[StandardHeaders.MessageId];
            }
            var transportMessage = new OutgoingTransportMessage(OutgoingHeaders, message, MessageSerializer.Serialize(message));

            this.Transport.Send(transportMessage, destinations);
        }
Esempio n. 2
0
        public string RequestTimeoutMessage(int secondsToWait, object timeoutMessage)
        {
            OutgoingHeaders[StandardHeaders.TimeoutMessageTimeout] = secondsToWait.ToString();
            OutgoingHeaders[StandardHeaders.ContentType]           = MessageSerializer.ContentType;
            OutgoingHeaders[StandardHeaders.EnclosedMessageTypes]  = string.Join(",", MessageMapper.GetEnclosedMessageTypes(timeoutMessage.GetType()).Distinct());
            if (currentMessageContext != null)
            {
                OutgoingHeaders[StandardHeaders.RelatedTo] = currentMessageContext[StandardHeaders.MessageId];
            }
            var transportMessage = new OutgoingTransportMessage(OutgoingHeaders, timeoutMessage, MessageSerializer.Serialize(timeoutMessage));

            return(this.Transport.RequestTimeoutMessage(secondsToWait, transportMessage));
        }
        public static void Serialize(OutgoingTransportMessage transportMessage, Stream outputStream)
        {
            var writer = new XmlTextWriter(outputStream, new UnicodeEncoding(false, false)); // SQL Server is UTF16, little endian, no BOM

            writer.Formatting = Formatting.Indented;
            writer.WriteStartElement("root");
            foreach (var item in transportMessage.Headers)
            {
                writer.WriteElementString(item.Key, item.Value);
            }
            writer.WriteStartElement("body");
            writer.WriteCData(transportMessage.SerializedMessageData);
            writer.WriteEndElement(); // </body>
            writer.WriteEndElement(); // </root>
            writer.Flush();
        }
Esempio n. 4
0
        public static void Serialize(OutgoingTransportMessage transportMessage, Stream outputStream)
        {
            var writer = new XmlTextWriter(outputStream, new UnicodeEncoding(false, false)); // SQL Server is UTF16, little endian, no BOM

            writer.Formatting = Formatting.Indented;
            writer.WriteStartElement("root");
            foreach (var item in transportMessage.Headers)
            {
                writer.WriteElementString(item.Key, item.Value);
            }
            writer.WriteStartElement("body");
            writer.WriteCData(transportMessage.SerializedMessageData);
            writer.WriteEndElement(); // </body>
            writer.WriteEndElement(); // </root>
            writer.Flush();
        }