public Message(TransportMessage message) { ReceivingEndpoint = EndpointDetails.ReceivingEndpoint(message); Id = message.Id + "-" + ReceivingEndpoint.Name; MessageId = message.Id; CorrelationId = message.CorrelationId; Recoverable = message.Recoverable; MessageIntent = message.MessageIntent; Headers = message.Headers.Select(header => new KeyValuePair <string, string>(header.Key, header.Value)); TimeSent = DateTimeExtensions.ToUtcDateTime(message.Headers[NServiceBus.Headers.TimeSent]); if (message.IsControlMessage()) { MessageType = "SystemMessage"; IsSystemMessage = true; } else { var messageTypeString = message.Headers[NServiceBus.Headers.EnclosedMessageTypes]; MessageType = GetMessageType(messageTypeString); IsSystemMessage = DetectSystemMessage(messageTypeString); ContentType = DetermineContentType(message); Body = DeserializeBody(message, ContentType); BodyRaw = message.Body; RelatedToMessageId = message.Headers.ContainsKey(NServiceBus.Headers.RelatedTo) ? message.Headers[NServiceBus.Headers.RelatedTo] : null; ConversationId = message.Headers[NServiceBus.Headers.ConversationId]; OriginatingSaga = SagaDetails.Parse(message); IsDeferredMessage = message.Headers.ContainsKey(NServiceBus.Headers.IsDeferredMessage); } OriginatingEndpoint = EndpointDetails.OriginatingEndpoint(message); }
public static EndpointDetails ReceivingEndpoint(TransportMessage message) { var endpoint = new EndpointDetails(); if (message.Headers.ContainsKey(Headers.ProcessingEndpoint)) { //todo: remove this line after we have updated to the next unstableversion (due to a bug in the core) if (message.Headers[Headers.ProcessingEndpoint] != Configure.EndpointName) { endpoint.Name = message.Headers[Headers.ProcessingEndpoint]; } } if (message.Headers.ContainsKey(Headers.ProcessingMachine)) { endpoint.Machine = message.Headers[Headers.ProcessingMachine]; } if (!string.IsNullOrEmpty(endpoint.Name) && !string.IsNullOrEmpty(endpoint.Name)) { return(endpoint); } var address = message.ReplyToAddress; //use the failed q to determine the receiving endpoint if (message.Headers.ContainsKey("NServiceBus.FailedQ")) { address = Address.Parse(message.Headers["NServiceBus.FailedQ"]); } endpoint.FromAddress(address); return(endpoint); }
public static EndpointDetails ReceivingEndpoint(TransportMessage message) { var endpoint = new EndpointDetails(); if (message.Headers.ContainsKey(Headers.ProcessingEndpoint)) { //todo: remove this line after we have updated to the next unstableversion (due to a bug in the core) if (message.Headers[Headers.ProcessingEndpoint] != Configure.EndpointName) endpoint.Name = message.Headers[Headers.ProcessingEndpoint]; } if (message.Headers.ContainsKey(Headers.ProcessingMachine)) { endpoint.Machine = message.Headers[Headers.ProcessingMachine]; } if (!string.IsNullOrEmpty(endpoint.Name) && !string.IsNullOrEmpty(endpoint.Name)) { return endpoint; } var address = message.ReplyToAddress; //use the failed q to determine the receiving endpoint if (message.Headers.ContainsKey("NServiceBus.FailedQ")) { address = Address.Parse(message.Headers["NServiceBus.FailedQ"]); } endpoint.FromAddress(address); return endpoint; }