Message Headers

Component: NServiceBus
NuGet Package NServiceBus (7.x)

The headers in a message contain information that is used by the messaging infrastructure to help with the message delivery. Message headers are very similar, in both implementation and usage, to HTTP headers. To learn more about how to use custom headers, see Manipulating message headers.

Timestamp format

For all timestamp message headers, the format is yyyy-MM-dd HH:mm:ss:ffffff Z where the time is UTC. The helper class DateTimeExtensions supports converting from UTC to wire format and vice versa by using the ToWireFormattedString() and ToUtcDateTime() methods.

const string Format = "yyyy-MM-dd HH:mm:ss:ffffff Z";

public static string ToWireFormattedString(DateTime dateTime)
{
    return dateTime.ToUniversalTime()
        .ToString(Format, CultureInfo.InvariantCulture);
}

public static DateTime ToUtcDateTime(string wireFormattedString)
{
    return DateTime.ParseExact(wireFormattedString, Format, CultureInfo.InvariantCulture)
       .ToUniversalTime();
}

Serialization headers

The following headers include information for the receiving endpoint on the message serialization option that was used.

NServiceBus.ContentType

The type of serialization used for the message, for example text/xml or text/json. In some cases, it may be useful to use the NServiceBus.Version header to determine how to use the value in this header appropriately.

NServiceBus.EnclosedMessageTypes

The fully qualified .NET type name of the enclosed message(s). The receiving endpoint will use this type when deserializing an incoming message. Depending on the versioning strategy the type can be specified in the following ways:

  • Full type name: Namespace.ClassName.
  • Assembly qualified name: Namespace.ClassName, AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
In integration scenarios, this header can be safely omitted if the endpoint uses XmlSerialization and the root node happens to be the message type.

Messaging interaction headers

The following headers are used to enable different messaging interaction patterns, such as Request-Response.

NServiceBus.MessageId

A unique ID for the current message.

NServiceBus.CorrelationId

NServiceBus implements the Correlation Identifier pattern by using a Correlation Id header.

Message correlation connects request messages with their corresponding response messages. The Correlation Id of the response message is the Correlation Id of its corresponding request message. Each outgoing message which is sent outside of a message handler will have its Correlation Id set to its Message Id.

An example of Correlation Identifier usage within NServiceBus can be found in callbacks.

Messages sent from a saga using the ReplyToOriginator method will have their Correlation Id set based on the message which caused the saga to be created. See Notifying callers of status for more information about the ReplyToOriginator method.

CorrId

CorrId is an MSMQ specific header semantically identical to NServiceBus.CorrelationId. It is included only for backward compatibility with endpoints running version 3 or older of NServiceBus.

NServiceBus.ConversationId

Identifier of the conversation that this message is part of. It enables the tracking of message flows that span more than one message exchange. Conversation Id and RelatedTo fields allow ServiceInsight to reconstruct the entire message flow.

The first message that is sent in a new flow is automatically assigned a unique Conversation Id that is then propagated to all the messages that are subsequently sent, thus forming a conversation. Each message that is sent within a conversation also has a RelatedTo value that identifies the originating message that caused it to be sent.

In certain scenarios Conversation Id has to be assigned manually, because NServiceBus can't infer that messages are correlated. For example, when a CancelOrder message needs to become part of an existing order conversation, then the Order Id can be used for correlating messages. This can be achieved by overriding the header with a custom value:

var sendOptions = new SendOptions();
sendOptions.SetHeader(Headers.ConversationId, "MyCustomConversationId/" + System.Guid.NewGuid());
await context.Send(new MyMessage(), sendOptions)
    .ConfigureAwait(false);

To get full control over the conversation ID, a custom convention can be registered:

config.CustomConversationIdStrategy(context =>
{
    if (context.Message.Instance is CancelOrder)
    {
        //use the order id as the conversation id
        return ConversationId.Custom("Order/" + ((CancelOrder)context.Message.Instance).OrderId);
    }

    //use the default generated id
    return ConversationId.Default;
});

This is useful to avoid setting the conversation ID when sending individual messages but rather apply a convention using a custom attribute, inheriting from an interface, using reflection based on message types, or some other method.

Note that attempting to override an existing Conversation Id will produce the following error:

Cannot set the NServiceBus.ConversationId header to 'XXXXX' as it cannot override the incoming header value ('2f4076a0-d8de-4297-9d18-a830015dd42a').
Conversation Id is very similar to Correlation Id. Both headers are copied to each new message that an endpoint produces. Whereas Conversation Id is always copied from the incoming message being handled, Correlation Id can come from another source (such as when replying from a saga using ReplyToOriginator(...)).

NServiceBus.RelatedTo

The MessageId that caused the current message to be sent. Whenever a message is sent or published from inside a message handler, it's RelatedTo header is set to the MessageId of the incoming message that was being handled.

For a single request-response interaction Correlation Id and RelatedTo are very similar. Both headers are able to correlate the response message back to the request message. Once a conversation is longer than a single request-response interaction, Correlation Id can be used to correlate a response to the original request. RelatedTo can only correlate a message back to the previous message in the same conversation.

NServiceBus.MessageIntent

Message intent can have one of the following values:

ValueDescription
SendRegular point-to-point send. Note that messages sent to the error queue will also have a Send intent
PublishThe message is an event that has been published and will be sent to all subscribers.
SubscribeA control message indicating that the source endpoint would like to subscribe to a specific message.
UnsubscribeA control message indicating that the source endpoint would like to unsubscribe to a specific message.
ReplyThe message has been initiated by doing a Reply or a Return from within a Handler or a Saga.

NServiceBus.ReplyToAddress

Downstream message handlers or sagas use this value as the reply queue address when replying or returning a message.

Send headers

When a message is sent, the headers will be as follows:

$.diagnostics.originating.hostid = 554380dd342ba9aa0ca1926e4510b1be
CorrId = 7ee9683c-8271-4bc3-a861-a65e00fa43fc\0
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = b1163c98-7662-40f1-88f3-a65e00fa43fc
NServiceBus.CorrelationId = 7ee9683c-8271-4bc3-a861-a65e00fa43fc
NServiceBus.EnclosedMessageTypes = Core6.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 7ee9683c-8271-4bc3-a861-a65e00fa43fc
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterSendV6
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterSendV6@MACHINENAME
NServiceBus.TimeSent = 2016-08-10 05:11:11:343014 Z
NServiceBus.Version = 6.0.0

In the above example, headers are for a Send and hence the MessageIntent header is Send. If the message were published instead, the MessageIntent header would be Publish.

Reply headers

When replying to a message:

  • The MessageIntent is Reply.
  • The RelatedTo will be the same as the initiating MessageID.
  • The ConversationId will be the same as the initiating ConversationId.
  • The CorrelationId will be same as the initiating CorrelationId.

Example reply headers

Given an initiating message with the following headers:

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = e5ab4240-75ad-40cc-9a81-a8140027a56a
NServiceBus.CorrelationId = 76cfdae2-4b35-42a7-97b4-a8140027a56a
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 76cfdae2-4b35-42a7-97b4-a8140027a56a
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterReplyV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterReplyV7
NServiceBus.TimeSent = 2017-10-22 02:24:20:835541 Z
NServiceBus.Version = 7.0.0

the headers of the reply message will be:

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = e5ab4240-75ad-40cc-9a81-a8140027a56a
NServiceBus.CorrelationId = 76cfdae2-4b35-42a7-97b4-a8140027a56a
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToReply, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 23770fdd-96bb-4fe0-9e95-a8140027a573
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterReplyV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.RelatedTo = 76cfdae2-4b35-42a7-97b4-a8140027a56a
NServiceBus.ReplyToAddress = HeaderWriterReplyV7
NServiceBus.Retries = 2
NServiceBus.Retries.Timestamp = 2017-10-22 02:24:31:977599 Z
NServiceBus.TimeSent = 2017-10-22 02:24:20:870710 Z
NServiceBus.Version = 7.0.0

Publish headers

When a message is published the headers will be as follows:

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 645af4b8-5bbf-4a31-b2a3-a8140027a537
NServiceBus.CorrelationId = db792449-55f0-4e27-a0c4-a8140027a537
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToPublish, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = db792449-55f0-4e27-a0c4-a8140027a537
NServiceBus.MessageIntent = Publish
NServiceBus.OriginatingEndpoint = HeaderWriterPublishV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterPublishV7
NServiceBus.TimeSent = 2017-10-22 02:24:20:667708 Z
NServiceBus.Version = 7.0.0

Return from a handler

When returning a message instead of replying:

  • The Return has the same points as the Reply example above with some additions.
  • The ReturnMessage.ErrorCode contains the value that was supplied to the Bus.Return method.

Example return headers

Given an initiating message with the following headers:

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = e3bef989-a1af-4583-95bb-a81400283cf8
NServiceBus.CorrelationId = bb0fa36f-2c18-483d-a17d-a81400283cf5
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = bb0fa36f-2c18-483d-a17d-a81400283cf5
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterReturnV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterReturnV7
NServiceBus.TimeSent = 2017-10-22 02:26:30:226468 Z
NServiceBus.Version = 7.0.0

the headers of reply message will be:

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ControlMessage = True
NServiceBus.ConversationId = e3bef989-a1af-4583-95bb-a81400283cf8
NServiceBus.CorrelationId = bb0fa36f-2c18-483d-a17d-a81400283cf5
NServiceBus.MessageId = 5c9ab6de-6423-4257-baf8-a81400283d8b
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterReturnV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.RelatedTo = bb0fa36f-2c18-483d-a17d-a81400283cf5
NServiceBus.ReplyToAddress = HeaderWriterReturnV7
NServiceBus.ReturnMessage.ErrorCode = 100
NServiceBus.TimeSent = 2017-10-22 02:26:30:655706 Z
NServiceBus.Version = 7.0.0

Timeout headers

NServiceBus.ClearTimeouts

A marker header to indicate that the contained control message is requesting that timeouts be cleared for a given saga.

NServiceBus.Timeout.Expire

A timestamp that indicates when a timeout should be fired.

NServiceBus.Timeout.RouteExpiredTimeoutTo

The queue name a timeout should be routed back to when it fires.

NServiceBus.IsDeferredMessage

A marker header to indicate that this message resulted from a Defer.

Saga-related headers

When a message is dispatched from within a saga the message will contain the following:

  • An OriginatingSagaId header which matches the ID used as the index for the saga data stored in persistence.
  • An OriginatingSagaType which is the fully qualified type name of the saga that sent the message.

Example "send from saga" headers

$.diagnostics.originating.hostid = 8cf0a8f78f9cd1885699777c83eb631e
CorrId = c5e3d16a-e295-4321-aea7-a5eb011ad6de\0
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = dbaf0a21-9b6a-49bd-ae76-a5eb011ad6df
NServiceBus.CorrelationId = c5e3d16a-e295-4321-aea7-a5eb011ad6de
NServiceBus.EnclosedMessageTypes = Core6.Headers.Writers.MyNamespace.SendFromSagaMessage, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = cb4c79a4-476c-4e64-aff1-a5eb011ad6e5
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterSagaV6
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.OriginatingSagaId = 0511aac4-13d0-44b9-a872-a5eb011ad6e4
NServiceBus.OriginatingSagaType = Core6.Headers.Writers.MyNamespace.Saga1, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.RelatedTo = c5e3d16a-e295-4321-aea7-a5eb011ad6de
NServiceBus.ReplyToAddress = HeaderWriterSagaV6@MACHINENAME
NServiceBus.TimeSent = 2016-04-17 07:09:47:211705 Z
NServiceBus.Version = 6.0.0

Replying to a saga

A message reply is performed from a saga will have the following headers:

  • The send headers are the same as a normal reply headers with a few additions.
  • Since this reply is from a secondary saga then OriginatingSagaId and OriginatingSagaType will match the second saga.
  • Since this is a reply to a the initial saga then the headers will contain SagaId and SagaType headers that match the initial saga.

Example "replying to a saga" headers

Via calling Bus.Reply

$.diagnostics.originating.hostid = 8cf0a8f78f9cd1885699777c83eb631e
CorrId = c5e3d16a-e295-4321-aea7-a5eb011ad6de\0
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = dbaf0a21-9b6a-49bd-ae76-a5eb011ad6df
NServiceBus.CorrelationId = c5e3d16a-e295-4321-aea7-a5eb011ad6de
NServiceBus.EnclosedMessageTypes = Core6.Headers.Writers.MyNamespace.ReplyFromSagaMessage, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 34907d38-48be-46ba-9cc2-a5eb011ad729
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterSagaV6
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.OriginatingSagaId = 25b7653a-5612-4e9e-b78f-a5eb011ad729
NServiceBus.OriginatingSagaType = Core6.Headers.Writers.MyNamespace.Saga2, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.RelatedTo = cb4c79a4-476c-4e64-aff1-a5eb011ad6e5
NServiceBus.ReplyToAddress = HeaderWriterSagaV6@MACHINENAME
NServiceBus.SagaId = 0511aac4-13d0-44b9-a872-a5eb011ad6e4
NServiceBus.SagaType = Core6.Headers.Writers.MyNamespace.Saga1, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.TimeSent = 2016-04-17 07:09:47:441082 Z
NServiceBus.Version = 6.0.0

Via calling Saga.ReplyToOriginator

$.diagnostics.originating.hostid = 8cf0a8f78f9cd1885699777c83eb631e
CorrId = cb4c79a4-476c-4e64-aff1-a5eb011ad6e5\0
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = dbaf0a21-9b6a-49bd-ae76-a5eb011ad6df
NServiceBus.CorrelationId = cb4c79a4-476c-4e64-aff1-a5eb011ad6e5
NServiceBus.EnclosedMessageTypes = Core6.Headers.Writers.MyNamespace.ReplyToOriginatorFromSagaMessage, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 818a5545-a038-4138-94c6-a5eb011ad72a
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterSagaV6
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.OriginatingSagaId = 25b7653a-5612-4e9e-b78f-a5eb011ad729
NServiceBus.OriginatingSagaType = Core6.Headers.Writers.MyNamespace.Saga2, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.RelatedTo = cb4c79a4-476c-4e64-aff1-a5eb011ad6e5
NServiceBus.ReplyToAddress = HeaderWriterSagaV6@MACHINENAME
NServiceBus.TimeSent = 2016-04-17 07:09:47:442082 Z
NServiceBus.Version = 6.0.0

Requesting a timeout from a saga

When requesting a timeout from a saga:

  • The OriginatingSagaId, OriginatingSagaType, SagaId and SagaType will all match the Saga that requested the Timeout.
  • The Timeout.RouteExpiredTimeoutTo header contains the queue name for where the callback for the timeout should be sent.
  • The Timeout.Expire header contains the timestamp for when the timeout should fire.

Example timeout headers

$.diagnostics.originating.hostid = 8cf0a8f78f9cd1885699777c83eb631e
CorrId = cb4c79a4-476c-4e64-aff1-a5eb011ad6e5\0
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = dbaf0a21-9b6a-49bd-ae76-a5eb011ad6df
NServiceBus.CorrelationId = cb4c79a4-476c-4e64-aff1-a5eb011ad6e5
NServiceBus.EnclosedMessageTypes = Core6.Headers.Writers.MyNamespace.TimeoutFromSaga, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.IsSagaTimeoutMessage = True
NServiceBus.MessageId = 433d5c9f-4968-4bf9-9c7e-a5eb011ad72a
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterSagaV6
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.OriginatingSagaId = 25b7653a-5612-4e9e-b78f-a5eb011ad729
NServiceBus.OriginatingSagaType = Core6.Headers.Writers.MyNamespace.Saga2, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.RelatedTo = cb4c79a4-476c-4e64-aff1-a5eb011ad6e5
NServiceBus.ReplyToAddress = HeaderWriterSagaV6@MACHINENAME
NServiceBus.SagaId = 25b7653a-5612-4e9e-b78f-a5eb011ad729
NServiceBus.SagaType = Core6.Headers.Writers.MyNamespace.Saga2, MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.Timeout.Expire = 2016-04-17 07:09:47:444081 Z
NServiceBus.Timeout.RouteExpiredTimeoutTo = HeaderWriterSagaV6@MACHINENAME
NServiceBus.TimeSent = 2016-04-17 07:09:47:443081 Z
NServiceBus.Version = 6.0.0

Defer a message

When deferring, the message will have similar header to a Send with a few differences:

  • The message will have IsDeferredMessage with the value of true.
  • Since the defer feature uses the timeouts feature the timeout headers will exist.
  • The Timeout.RouteExpiredTimeoutTo header contains the queue name for where the callback for the timeout should be sent.
  • The Timeout.Expire header contains the timestamp for when the timeout should fire.

Example defer headers

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 0f90fe05-4a01-480e-ad3a-a8140027a02c
NServiceBus.CorrelationId = e1baa04a-c88c-4fc4-bf8b-a8140027a02b
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = e1baa04a-c88c-4fc4-bf8b-a8140027a02b
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterDeferV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterDeferV7
NServiceBus.TimeSent = 2017-10-22 02:24:16:359575 Z
NServiceBus.Version = 7.0.0

Diagnostic and informational headers

Headers used to give visibility into "where", "when" and "by whom" of a message. They are used by ServiceControl, ServiceInsight and ServicePulse.

$.diagnostics

The host details of the endpoint where the message was being processed. This header contains three parts:

  • $.diagnostics.hostdisplayname
  • $.diagnostics.hostid
  • $.diagnostics.originating.hostid

NServiceBus.TimeSent

The timestamp when the message was sent. Used by the Performance Counters.

NServiceBus.OriginatingEndpoint

The endpoint name the message was sent from.

NServiceBus.OriginatingMachine

The machine name the message was sent from.

NServiceBus.Version

The NServiceBus version number.

Audit headers

Headers added when a message is audited

NServiceBus.ProcessingEnded

The timestamp when processing of a message ended.

NServiceBus.ProcessingEndpoint

Name of the endpoint where the message was processed.

NServiceBus.ProcessingMachine

The machine name of the endpoint where the message was processed.

NServiceBus.ProcessingStarted

The timestamp when the processing of this message started.

Example audit headers

Given an initiating message with the following headers:

$.diagnostics.hostdisplayname = MACHINENAME
$.diagnostics.hostid = 47f4a8452c9e9663df88992240c011ca
$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 2724b3b6-1c1e-45fd-95f7-a8140022f474
NServiceBus.CorrelationId = 67c7cee5-ce8b-43a2-82a8-a8140022f470
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 67c7cee5-ce8b-43a2-82a8-a8140022f470
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterAuditV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ProcessingEnded = 2017-10-22 02:07:16:580459 Z
NServiceBus.ProcessingEndpoint = HeaderWriterAuditV7
NServiceBus.ProcessingMachine = MACHINENAME
NServiceBus.ProcessingStarted = 2017-10-22 02:07:16:579455 Z
NServiceBus.ReplyToAddress = HeaderWriterAuditV7
NServiceBus.TimeSent = 2017-10-22 02:07:16:091335 Z
NServiceBus.Version = 7.0.0

when that message fails to be processed, it will be sent to the error queue with the following headers:

$.diagnostics.hostdisplayname = MACHINENAME
$.diagnostics.hostid = 47f4a8452c9e9663df88992240c011ca
$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 307ceba2-9681-46f4-8482-a81400279f28
NServiceBus.CorrelationId = e0516f9f-e07f-41fc-8be9-a81400279f26
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = e0516f9f-e07f-41fc-8be9-a81400279f26
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterAuditV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ProcessingEnded = 2017-10-22 02:24:15:804151 Z
NServiceBus.ProcessingEndpoint = HeaderWriterAuditV7
NServiceBus.ProcessingMachine = MACHINENAME
NServiceBus.ProcessingStarted = 2017-10-22 02:24:15:802647 Z
NServiceBus.ReplyToAddress = HeaderWriterAuditV7
NServiceBus.TimeSent = 2017-10-22 02:24:15:556946 Z
NServiceBus.Version = 7.0.0

Retries handling headers

Headers used to facilitate retries.

These headers will only exist after the initial retry has occurred.

NServiceBus.FailedQ

The queue at which the message processing failed.

NServiceBus.FLRetries

The number of immediate retries that have been performed for a message.

NServiceBus.Retries

The number of delayed retries that have been performed for a message.

NServiceBus.Retries.Timestamp

A timestamp used by delayed retries to determine if the maximum time for retrying has been reached.

Error forwarding headers

When a message is handled by recoverability, it will have the following extra headers added to the existing headers. If retries occurred, then those messages will be included with the exception of NServiceBus.Retries, which is removed.

NServiceBus.ExceptionInfo.ExceptionType

The Type.FullName of the Exception. It is obtained by calling Exception.GetType().FullName.

NServiceBus.ExceptionInfo.InnerExceptionType

The full type name of the InnerException if it exists. It is obtained by calling Exception.InnerException.GetType().FullName.

NServiceBus.ExceptionInfo.HelpLink

The exception help link.

NServiceBus.ExceptionInfo.Message

The exception message.

NServiceBus.ExceptionInfo.Source

The exception source.

NServiceBus.ExceptionInfo.StackTrace

The exception stack trace.

Example error headers

Given an initiating message with the following headers:

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 640fc964-ed94-4b8a-88bc-a8140027a192
NServiceBus.CorrelationId = 4e919f23-6634-4f27-9e49-a8140027a192
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 4e919f23-6634-4f27-9e49-a8140027a192
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterErrorV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterErrorV7
NServiceBus.TimeSent = 2017-10-22 02:24:17:554556 Z
NServiceBus.Version = 7.0.0

when that message fails to be processed, it will be sent to the error queue with the following headers:

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 640fc964-ed94-4b8a-88bc-a8140027a192
NServiceBus.CorrelationId = 4e919f23-6634-4f27-9e49-a8140027a192
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 4e919f23-6634-4f27-9e49-a8140027a192
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterErrorV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterErrorV7
NServiceBus.TimeSent = 2017-10-22 02:24:17:554556 Z
NServiceBus.Version = 7.0.0

Encryption headers

Headers when using message property encryption.

NServiceBus.RijndaelKeyIdentifier

Identifies the encryption key used for encryption of the message property fragments.

Example headers

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 9748f343-d203-4a5d-903b-a8140027a181
NServiceBus.CorrelationId = de0b7b35-ce61-47db-a18c-a8140027a181
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = de0b7b35-ce61-47db-a18c-a8140027a181
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterEncryptionV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterEncryptionV7
NServiceBus.TimeSent = 2017-10-22 02:24:17:497906 Z
NServiceBus.Version = 7.0.0

Example body

<?xml version="1.0"?><MessageToSend xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.net/Core7.Headers.Writers"><EncryptedProperty1>String 1</EncryptedProperty1><EncryptedProperty2>String 2</EncryptedProperty2></MessageToSend>

FileShare DataBus headers

When using the FileShare DataBus, extra headers and serialized message information are necessary to correlate between the information on the queue and the data on the file system.

Using DataBusProperty

When using the DataBusProperty, NServiceBus uses that property as a placeholder at serialization time. The serialized value of that property will contain a key. This key maps to a named header. That header then provides the path suffix of where that binary data is stored on disk on the file system.

Example headers

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = d732d3a9-3cc4-461e-80b4-a81400279feb
NServiceBus.CorrelationId = 95591ffb-a8c3-4d66-96e6-a81400279feb
NServiceBus.DataBus.2017-10-22_13\281a41da-51ea-4270-8af6-d2d75701232c = 2017-10-22_13\281a41da-51ea-4270-8af6-d2d75701232c
NServiceBus.DataBus.2017-10-22_13\deeb0545-fbef-4f94-8471-aef59fbf3dd6 = 2017-10-22_13\deeb0545-fbef-4f94-8471-aef59fbf3dd6
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 95591ffb-a8c3-4d66-96e6-a81400279feb
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterDataBusPropertyV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterDataBusPropertyV7
NServiceBus.TimeSent = 2017-10-22 02:24:16:149839 Z
NServiceBus.Version = 7.0.0

Example body

<?xml version="1.0"?><MessageToSend xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.net/Core7.Headers.Writers"><LargeProperty1><Key>2017-10-22_13\281a41da-51ea-4270-8af6-d2d75701232c</Key><HasValue>true</HasValue></LargeProperty1><LargeProperty2><Key>2017-10-22_13\deeb0545-fbef-4f94-8471-aef59fbf3dd6</Key><HasValue>true</HasValue></LargeProperty2></MessageToSend>

Using conventions

When using conventions there is no way to store a correlation value inside the serialized property. Instead, each property has a matching header with the property name used as the header suffix. That header then provides the path suffix of where that binary data is stored on disk on the file system.

Example headers

$.diagnostics.originating.hostid = 47f4a8452c9e9663df88992240c011ca
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = f751a013-0812-4e00-8a2c-a81400279fb7
NServiceBus.CorrelationId = 44963f45-4233-4c20-a24b-a81400279fb7
NServiceBus.DataBus.Core7.Headers.Writers.MyNamespace.MessageToSend.LargeProperty1 = 2017-10-22_13\e2495ddc-d1f0-41ce-ac70-9ec693a40ecd
NServiceBus.DataBus.Core7.Headers.Writers.MyNamespace.MessageToSend.LargeProperty2 = 2017-10-22_13\84bcd43c-6781-4368-99ae-e6c652a3fd5c
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 44963f45-4233-4c20-a24b-a81400279fb7
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterDataBusConventionV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterDataBusConventionV7
NServiceBus.TimeSent = 2017-10-22 02:24:16:016043 Z
NServiceBus.Version = 7.0.0

Example body

<?xml version="1.0"?><MessageToSend xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.net/Core7.Headers.Writers"></MessageToSend>

Samples

Related Articles


Last modified