Ejemplo n.º 1
0
        public static void ForwardUsingOriginalContext(this ISendContext target,
                                                       IConsumeContext source)
        {
            target.SetRequestId(source.RequestId);
            target.SetConversationId(source.ConversationId);
            target.SetCorrelationId(source.CorrelationId);
            target.SetSourceAddress(source.SourceAddress);
            target.SetResponseAddress(source.ResponseAddress);
            target.SetFaultAddress(source.FaultAddress);
            target.SetNetwork(source.Network);
            if (source.ExpirationTime.HasValue)
            {
                target.SetExpirationTime(source.ExpirationTime.Value);
            }
            target.SetRetryCount(source.RetryCount);

            foreach (var header in source.Headers)
            {
                target.SetHeader(header.Key, header.Value);
            }

            var inputAddress = source.InputAddress != null
                                   ? source.InputAddress.ToString()
                                   : source.DestinationAddress != null
                                         ? source.DestinationAddress.ToString()
                                         : null;

            if (!string.IsNullOrEmpty(inputAddress))
            {
                target.SetHeader("mt.forwarder.uri", source.DestinationAddress.ToString());
            }
        }
Ejemplo n.º 2
0
        public static void ForwardUsingOriginalContext<T>(this ISendContext target,
            IConsumeContext<T> source)
            where T : class
        {
            target.SetRequestId(source.RequestId);
            target.SetConversationId(source.ConversationId);
            target.SetCorrelationId(source.CorrelationId);
            target.SetResponseAddress(source.ResponseAddress);
            target.SetFaultAddress(source.FaultAddress);
            target.SetNetwork(source.Network);
            if (source.ExpirationTime.HasValue)
                target.SetExpirationTime(source.ExpirationTime.Value);
            target.SetRetryCount(source.RetryCount);

            foreach (var header in source.Headers)
            {
                target.SetHeader(header.Key, header.Value);
            }
        }
 void SetSendContext <T>(ISendContext <T> context)
     where T : class
 {
     context.SetNetwork(_network);
     context.SetSourceAddress(_peerUri);
 }