コード例 #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());
            }
        }
コード例 #2
0
        /// <summary>
        /// Sets the response address of the message to be send to the given <see cref="IEndpoint"/>.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="context">The context.</param>
        /// <param name="endpoint">The endpoint.</param>
        public static void SendResponseTo <T>(this ISendContext <T> context, [NotNull] IEndpoint endpoint)
            where T : class
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException("endpoint");
            }

            context.SetResponseAddress(endpoint.Address.Uri);
        }
コード例 #3
0
        /// <summary>
        /// Sets the response address of the message to be send to the <see cref="IEndpoint"/> of the given <see cref="IServiceBus"/>.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="context">The context.</param>
        /// <param name="bus">The bus.</param>
        public static void SendResponseTo <T>(this ISendContext <T> context, [NotNull] IServiceBus bus)
            where T : class
        {
            if (bus == null)
            {
                throw new ArgumentNullException("bus");
            }

            context.SetResponseAddress(bus.Endpoint.Address.Uri);
        }
コード例 #4
0
        /// <summary>
        /// Sets the response address of the message to be send.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="context">The context.</param>
        /// <param name="uriString">The URI string.</param>
        public static void SetResponseAddress <T>(this ISendContext <T> context, [NotNull] string uriString)
            where T : class
        {
            if (uriString == null)
            {
                throw new ArgumentNullException("uriString");
            }

            context.SetResponseAddress(uriString.ToUri());
        }
コード例 #5
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);
            }
        }
コード例 #6
0
 public static void SendResponseTo <T>(this ISendContext <T> context, Uri uri)
     where T : class
 {
     context.SetResponseAddress(uri);
 }
コード例 #7
0
 public static void SendResponseTo <T>(this ISendContext <T> context, IEndpoint endpoint)
     where T : class
 {
     context.SetResponseAddress(endpoint.Address.Uri);
 }
コード例 #8
0
 public static void SendResponseTo <T>(this ISendContext <T> context, IServiceBus bus)
     where T : class
 {
     context.SetResponseAddress(bus.Endpoint.Address.Uri);
 }
コード例 #9
0
 public static void SetResponseAddress <T>(this ISendContext <T> context, string uriString)
     where T : class
 {
     context.SetResponseAddress(uriString.ToUri());
 }