예제 #1
0
        BrokeredMessage CreateBrokeredMessage(Envelope envelope)
        {
            var brokeredMessage = new BrokeredMessage(envelope);

            if (envelope.Headers.ContainsKey(Headers.MessageId))
            {
                brokeredMessage.MessageId = envelope.Headers[Headers.MessageId];
            }

            if (envelope.Headers.ContainsKey(Headers.CorrelationId))
            {
                brokeredMessage.CorrelationId = envelope.Headers[Headers.CorrelationId];
            }

            if (envelope.Headers.ContainsKey(Headers.ReturnAddress))
            {
                brokeredMessage.ReplyTo = envelope.Headers[Headers.ReturnAddress];
            }

            brokeredMessage.Label = envelope.Label;

            return brokeredMessage;
        }
예제 #2
0
 ReceivedTransportMessage CreateReceivedTransportMessage(string messageId, Envelope envelope)
 {
     return new ReceivedTransportMessage
     {
         Id = messageId,
         Headers = envelope.Headers == null
             ? new Dictionary<string, object>()
             : envelope.Headers.ToDictionary(e => e.Key, e => (object)e.Value),
         Body = envelope.Body,
         Label = envelope.Label
     };
 }