public TransportMessage(TransportMessage message)
        {
            Headers = new Dictionary<string, string>
            {
                {HeaderKeys.MessageId, message.Id},
                {HeaderKeys.CorrelationId, message.CorrelationId},
                {HeaderKeys.MessageType, message.MessageType},
                {HeaderKeys.ReplyTo, message.ReplyTo?.ToString() }
            };

            var stream = new MemoryStream();
            message.Body.Position = 0;
            message.Body.CopyTo(stream);
            stream.Position = 0;
            SetBody(stream);

            foreach (var pair in message.Headers)
            {
                if (!Headers.ContainsKey(pair.Key))
                {
                    Headers.Add(pair.Key, pair.Value);
                }
            }
        }
示例#2
0
 static Task Connector(ChainFactory factory, TransportMessage message)
 {
     var pipeline = factory.Create();
     var context = new IncomingContext(message);
     return pipeline.Invoke(context);
 }