Example #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());
            }
        }
 /// <summary>
 /// Sets the fault address of the message to be send to the given <see cref="Uri"/>.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="context">The context.</param>
 /// <param name="uri">The URI.</param>
 public static void SendFaultTo <T>(this ISendContext <T> context, [NotNull] Uri uri)
     where T : class
 {
     if (uri == null)
     {
         throw new ArgumentNullException("uri");
     }
     context.SetFaultAddress(uri);
 }
 /// <summary>
 /// Sets the fault 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 SendFaultTo <T>(this ISendContext <T> context, [NotNull] IEndpoint endpoint)
     where T : class
 {
     if (endpoint == null)
     {
         throw new ArgumentNullException("endpoint");
     }
     context.SetFaultAddress(endpoint.Address.Uri);
 }
 /// <summary>
 /// Sets the fault address of the message to be send to 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 SendFaultTo <T>(this ISendContext <T> context, [NotNull] IServiceBus bus)
     where T : class
 {
     if (bus == null)
     {
         throw new ArgumentNullException("bus");
     }
     context.SetFaultAddress(bus.Endpoint.Address.Uri);
 }
 /// <summary>
 /// Sets the fault address of the message to be send to the given uri.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="context">The context.</param>
 /// <param name="uriString">The URI string.</param>
 public static void SetFaultAddress <T>(this ISendContext <T> context, [NotNull] string uriString)
     where T : class
 {
     if (uriString == null)
     {
         throw new ArgumentNullException("uriString");
     }
     context.SetFaultAddress(uriString.ToUri());
 }
Example #6
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);
            }
        }
 public static void SendFaultTo <T>(this ISendContext <T> context, Uri uri)
     where T : class
 {
     context.SetFaultAddress(uri);
 }
 public static void SendFaultTo <T>(this ISendContext <T> context, IEndpoint endpoint)
     where T : class
 {
     context.SetFaultAddress(endpoint.Address.Uri);
 }
 public static void SendFaultTo <T>(this ISendContext <T> context, IServiceBus bus)
     where T : class
 {
     context.SetFaultAddress(bus.Endpoint.Address.Uri);
 }
 public static void SetFaultAddress <T>(this ISendContext <T> context, string uriString)
     where T : class
 {
     context.SetFaultAddress(uriString.ToUri());
 }