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()); } }
public void PreDispatch(ISendContext context) { if (!string.IsNullOrEmpty(context.Headers[Constants.TenantIdKey])) { return; } object tenantId; if (_identificationStrategy.TryIdentifyTenant(out tenantId)) { context.SetHeader(Constants.TenantIdKey, tenantId.ToString()); } }
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); } }
private void PersistMessageSentTime(ISendContext sendContext, DateTimeOffset sentTime) { sendContext.SetHeader(MessageSentKey, sentTime.ToString("O")); }
private void PersistCorrelationId(ISendContext sendContext, Guid correlationId) { sendContext.SetHeader(CorrelationIdKey, correlationId.ToString("D")); }