The headers of a message are similar to HTTP headers and contain metadata about the message being sent over the queueing system. This document describes the headers used by NServiceBus. To learn more about how to use custom headers, see the documentation on 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();
}
Transport headers
NServiceBus.NonDurableMessage
The NonDurableMessage
header controls non-durable messaging persistence behavior of in-flight messages. The behavior is transport specific but the intent is to not store the message durably on disk and only keep it in memory.
NServiceBus.TimeToBeReceived
The TimeToBeReceived
header controls when a message becomes obsolete and can be discarded. The behavior is transport-dependent.
NServiceBus.Transport.Encoding
States what type of body serialization is used. Used only by the legacy Azure Service Bus transport which is no longer supported.
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/
, text/
, application/
, or application/
. In some cases, it may be useful to use the NServiceBus.
header to determine how to use the value in this header appropriately.
Although this header mimicks the HTTP Content-Type header the values are case-sensitive. The header value does not behave like HTTP headers where everything after ;
is used to order and match the best qualified (application/json) serializer. Adding a suffix like ; systemjson
requires all endpoints involved to use this full key (for example: application/
).
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
See the message type detection documentation for more details.
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.
. It is included only for backward compatibility with endpoints running version 3 or older of NServiceBus.
NServiceBus.ConversationId
The identifier of the conversation that this message is part of. It enables the tracking of message flows that span more than one message exchange. ConversationId
, RelatedTo
, OriginatingEndpoint
, and ProcessingEndpoint
fields allow ServiceInsight to reconstruct the entire message flow.
The first message sent in a new flow is automatically assigned a unique ConversationId
that gets propagated to all the messages that are sent afterward, forming a conversation. Each message sent within a conversation has a RelatedTo
value that identifies the message that caused it to be sent.
The ConversationId
must be assigned manually in cases where NServiceBus can't infer when messages belong to the same conversation. For example, when a CancelOrder
message must be part of an existing order conversation, then the Order ID can be used for as the Conversation ID. Manually assigning a ConversationId
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);
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.
Attempting to override an existing Conversation ID is not supported and 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(.
).
Starting a new conversation
In some scenarios though, starting a new conversation might be desirable. For example, a batch import that reads thousands of records and starts a workflow on each one would normally result in a giant visualization, where it would be more appropriate for each record to be a new conversation.
Starting a new conversation can be done with the help of SendOptions:
var sendOptions = new SendOptions();
sendOptions.StartNewConversation();
await context.Send(new CancelOrder(), sendOptions);
A custom Conversation ID
can also be provided:
var sendOptions = new SendOptions();
sendOptions.StartNewConversation("MyCustomConversationId/" + System.Guid.NewGuid());
await context.Send(new CancelOrder(), sendOptions);
NServiceBus.RelatedTo
The MessageId
that caused the current message to be sent. Whenever a message is sent or published from inside a message handler, its 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:
Value | Description |
---|---|
Send | Regular point-to-point send. Note that messages sent to the error queue will also have a Send intent |
Publish | The message is an event that has been published and will be sent to all subscribers. |
Subscribe | A control message indicating that the source endpoint would like to subscribe to a specific message. |
Unsubscribe | A control message indicating that the source endpoint would like to unsubscribe to a specific message. |
Reply | The message has been initiated by doing a Reply or a Return from within a Handler or a Saga. |
NServiceBus.ControlMessage
Indicates that the message is a control message, ie has no body and the intent of the message and any data is transmitted in the message headers.
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 = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 449433df-94c4-467a-86ec-ae45015f4905
NServiceBus.CorrelationId = 93d30b83-78e3-4357-a831-ae45015f4905
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 93d30b83-78e3-4357-a831-ae45015f4905
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterSendV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterSendV7
NServiceBus.TimeSent = 2022-02-23 21:18:59:424400 Z
NServiceBus.Version = 7.7.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
isReply
. - The
RelatedTo
will be the same as the initiatingMessageID
. - The
ConversationId
will be the same as the initiatingConversationId
. - The
CorrelationId
will be the same as the initiatingCorrelationId
.
Example reply headers
Given an initiating message with the following headers:
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = de64b1e3-1fb6-4ff5-a738-ae45015f481b
NServiceBus.CorrelationId = e7c6c64f-dbba-4358-ba8d-ae45015f481b
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = e7c6c64f-dbba-4358-ba8d-ae45015f481b
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterReplyV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterReplyV7
NServiceBus.TimeSent = 2022-02-23 21:18:58:644442 Z
NServiceBus.Version = 7.7.0
the headers of the reply message will be:
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = de64b1e3-1fb6-4ff5-a738-ae45015f481b
NServiceBus.CorrelationId = e7c6c64f-dbba-4358-ba8d-ae45015f481b
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToReply, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 686cdc08-e728-4395-a406-ae45015f4824
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterReplyV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.RelatedTo = e7c6c64f-dbba-4358-ba8d-ae45015f481b
NServiceBus.ReplyToAddress = HeaderWriterReplyV7
NServiceBus.TimeSent = 2022-02-23 21:18:58:681461 Z
NServiceBus.Version = 7.7.0
Publish headers
When a message is published the headers will be as follows:
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 7554b538-54f4-4e9b-b13e-ae45015f47da
NServiceBus.CorrelationId = 11521722-ed0f-4299-8a12-ae45015f47d9
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToPublish, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 11521722-ed0f-4299-8a12-ae45015f47d9
NServiceBus.MessageIntent = Publish
NServiceBus.OriginatingEndpoint = HeaderWriterPublishV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterPublishV7
NServiceBus.TimeSent = 2022-02-23 21:18:58:428461 Z
NServiceBus.Version = 7.7.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.
contains the value that was supplied to theErrorCode Bus.
method.Return
Example return headers
Given an initiating message with the following headers:
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = d7bbbaf2-f980-46fc-a2aa-ae45015f485d
NServiceBus.CorrelationId = a28894b2-4025-4264-9086-ae45015f485d
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = a28894b2-4025-4264-9086-ae45015f485d
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterReturnV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterReturnV7
NServiceBus.TimeSent = 2022-02-23 21:18:58:865434 Z
NServiceBus.Version = 7.7.0
the headers of reply message will be:
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ControlMessage = True
NServiceBus.ConversationId = d7bbbaf2-f980-46fc-a2aa-ae45015f485d
NServiceBus.CorrelationId = a28894b2-4025-4264-9086-ae45015f485d
NServiceBus.MessageId = 1ed5fb5d-dac8-44e5-a71c-ae45015f4868
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterReturnV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.RelatedTo = a28894b2-4025-4264-9086-ae45015f485d
NServiceBus.ReplyToAddress = HeaderWriterReturnV7
NServiceBus.ReturnMessage.ErrorCode = 100
NServiceBus.TimeSent = 2022-02-23 21:18:58:901433 Z
NServiceBus.Version = 7.7.0
Timeout headers
NServiceBus.ClearTimeouts
A 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 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 = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = f492357e-6cd2-4246-b024-ae45015f48a8
NServiceBus.CorrelationId = 77440027-d691-4a4a-8310-ae45015f48a8
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.SendFromSagaMessage, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = d0166eaf-9d7d-4c40-bcec-ae45015f48b8
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterSagaV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.OriginatingSagaId = 6852f775-610a-1fd0-a32f-f6728026ede1
NServiceBus.OriginatingSagaType = Core7.Headers.Writers.MyNamespace.Saga1, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.RelatedTo = 77440027-d691-4a4a-8310-ae45015f48a8
NServiceBus.ReplyToAddress = HeaderWriterSagaV7
NServiceBus.TimeSent = 2022-02-23 21:18:59:169411 Z
NServiceBus.Version = 7.7.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
andOriginatingSagaType
will match the second saga. - Since this is a reply to the initial saga then the headers will contain
SagaId
andSagaType
headers that match the initial saga.
Example "replying to a saga" headers
Via calling Bus.Reply
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = f492357e-6cd2-4246-b024-ae45015f48a8
NServiceBus.CorrelationId = 77440027-d691-4a4a-8310-ae45015f48a8
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.ReplyFromSagaMessage, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 1f1361c9-8594-4661-bd15-ae45015f48c3
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterSagaV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.OriginatingSagaId = d01eda9e-11ed-77d8-4af2-baeddf524957
NServiceBus.OriginatingSagaType = Core7.Headers.Writers.MyNamespace.Saga2, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.RelatedTo = d0166eaf-9d7d-4c40-bcec-ae45015f48b8
NServiceBus.ReplyToAddress = HeaderWriterSagaV7
NServiceBus.SagaId = 6852f775-610a-1fd0-a32f-f6728026ede1
NServiceBus.SagaType = Core7.Headers.Writers.MyNamespace.Saga1, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.TimeSent = 2022-02-23 21:18:59:205412 Z
NServiceBus.Version = 7.7.0
Via calling Saga.ReplyToOriginator
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = f492357e-6cd2-4246-b024-ae45015f48a8
NServiceBus.CorrelationId = d0166eaf-9d7d-4c40-bcec-ae45015f48b8
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.ReplyToOriginatorFromSagaMessage, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 715a65eb-3c37-447d-88bb-ae45015f48c4
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterSagaV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.OriginatingSagaId = d01eda9e-11ed-77d8-4af2-baeddf524957
NServiceBus.OriginatingSagaType = Core7.Headers.Writers.MyNamespace.Saga2, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.RelatedTo = d0166eaf-9d7d-4c40-bcec-ae45015f48b8
NServiceBus.ReplyToAddress = HeaderWriterSagaV7
NServiceBus.TimeSent = 2022-02-23 21:18:59:206421 Z
NServiceBus.Version = 7.7.0
Requesting a timeout from a saga
When requesting a timeout from a saga:
- The
OriginatingSagaId
,OriginatingSagaType
,SagaId
andSagaType
will all match the Saga that requested the Timeout. - The
Timeout.
header contains the queue name for where the callback for the timeout should be sent.RouteExpiredTimeoutTo - The
Timeout.
header contains the timestamp for when the timeout should fire.Expire
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 headers compared to a send, but will be delivered later.
In NServiceBus version 7.7 and above, the DeliverAt
header will also be added containing the time when the message was targeted to be delivered.
Example defer headers
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 80d1c3f4-432d-47b7-a666-ae45015f4251
NServiceBus.CorrelationId = 5cc1d1b7-c3cf-45e4-827a-ae45015f4250
NServiceBus.DeliverAt = 2022-02-23 21:18:53:712603 Z
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 5cc1d1b7-c3cf-45e4-827a-ae45015f4250
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterDeferV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterDeferV7
NServiceBus.TimeSent = 2022-02-23 21:18:53:702603 Z
NServiceBus.Version = 7.7.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.DeliverAt
The timestamp when the message should be delivered. Used for more accurate calculation of critical time.
NServiceBus.OriginatingEndpoint
The endpoint name the message was sent from.
Used for linking messages in ServiceInsight. See NServiceBus.ConversationId
NServiceBus.OriginatingMachine
The machine name the message was sent from.
NServiceBus.Version
The NServiceBus version number.
OpenTelemetry-related headers
These headers are added when OpenTelemetry is enabled for an endpoint, in accordance with the W3C Trace Context specification:
Audit headers
Headers added when a message is audited
NServiceBus.ProcessingEnded
The timestamp when the processing of a message ended.
NServiceBus.ProcessingEndpoint
Name of the endpoint where the message was processed.
Used for linking messages in ServiceInsight. See NServiceBus.ConversationId
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.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 723c1f31-c802-40a9-a874-ae45015f4119
NServiceBus.CorrelationId = c01d295d-a35c-4811-b829-ae45015f4117
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = c01d295d-a35c-4811-b829-ae45015f4117
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterAuditV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterAuditV7
NServiceBus.TimeSent = 2022-02-23 21:18:52:706641 Z
NServiceBus.Version = 7.7.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 = 5fc2d3fe172c2602b7e1b665f355aa9d
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 723c1f31-c802-40a9-a874-ae45015f4119
NServiceBus.CorrelationId = c01d295d-a35c-4811-b829-ae45015f4117
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = c01d295d-a35c-4811-b829-ae45015f4117
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterAuditV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ProcessingEnded = 2022-02-23 21:18:53:054640 Z
NServiceBus.ProcessingEndpoint = HeaderWriterAuditV7
NServiceBus.ProcessingMachine = MACHINENAME
NServiceBus.ProcessingStarted = 2022-02-23 21:18:53:007635 Z
NServiceBus.ReplyToAddress = HeaderWriterAuditV7
NServiceBus.TimeSent = 2022-02-23 21:18:52:706641 Z
NServiceBus.Version = 7.7.0
Retries handling headers
Headers used to facilitate retries.
These headers only exist after the first round of immediate reties has finished and are removed before sending a message to the error queue after all allowed retry attempts are exhausted.
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 exhausts the configured number of retry attempts and is moved to the error queue by the recoverability component, it will have the following extra headers added to the existing headers.
NServiceBus.FailedQ
The queue at which the message processing failed.
NServiceBus.ExceptionInfo.ExceptionType
The Type.FullName of the Exception. It is obtained by calling Exception.
.
NServiceBus.ExceptionInfo.InnerExceptionType
The full type name of the InnerException if it exists. It is obtained by calling Exception.
.
NServiceBus.ExceptionInfo.HelpLink
The exception help link.
NServiceBus.ExceptionInfo.Message
The exception message.
NServiceBus.ExceptionInfo.Source
The exception source.
NServiceBus.ExceptionInfo.StackTrace
Example error headers
Given an initiating message with the following headers:
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 8815adae-fb2c-4f97-bb06-ae45015f4401
NServiceBus.CorrelationId = 49b3223e-4099-4345-b491-ae45015f4401
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 49b3223e-4099-4345-b491-ae45015f4401
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterErrorV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterErrorV7
NServiceBus.TimeSent = 2022-02-23 21:18:55:144867 Z
NServiceBus.Version = 7.7.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 = 5fc2d3fe172c2602b7e1b665f355aa9d
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 8815adae-fb2c-4f97-bb06-ae45015f4401
NServiceBus.CorrelationId = 49b3223e-4099-4345-b491-ae45015f4401
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.ExceptionInfo.Data.Handler failure time = 2022-02-23 21:18:55:261026 Z
NServiceBus.ExceptionInfo.Data.Handler start time = 2022-02-23 21:18:55:261026 Z
NServiceBus.ExceptionInfo.Data.Handler type = Core7.Headers.Writers.MyNamespace.MessageHandler
NServiceBus.ExceptionInfo.Data.Message ID = 49b3223e-4099-4345-b491-ae45015f4401
NServiceBus.ExceptionInfo.Data.Message type = Core7.Headers.Writers.MyNamespace.MessageToSend
NServiceBus.ExceptionInfo.Data.Transport message ID = 6caa0e2f-d85a-4b4d-8dd7-c1f646bdc1ea
NServiceBus.ExceptionInfo.ExceptionType = System.Exception
NServiceBus.ExceptionInfo.HelpLink =
NServiceBus.ExceptionInfo.Message = The exception message from the handler.
NServiceBus.ExceptionInfo.Source = Core_7
NServiceBus.ExceptionInfo.StackTrace = System.Exception: The exception message from the handler.
at Core7.Headers.Writers.HeaderWriterError.MessageHandler.Handle(MessageToSend message, IMessageHandlerContext context)
at NServiceBus.InvokeHandlerTerminator.<Terminate>d__0.MoveNext()
at NServiceBus.LoadHandlersConnector.<Invoke>d__1.MoveNext()
at NServiceBus.ScheduledTaskHandlingBehavior.<Invoke>d__1.MoveNext()
at NServiceBus.DeserializeMessageConnector.<Invoke>d__1.MoveNext()
at NServiceBus.ProcessingStatisticsBehavior.<Invoke>d__0.MoveNext()
at NServiceBus.TransportReceiveToPhysicalMessageConnector.<Invoke>d__1.MoveNext()
at NServiceBus.RetryAcknowledgementBehavior.<Invoke>d__2.MoveNext()
at NServiceBus.MainPipelineExecutor.<Invoke>d__1.MoveNext()
at NServiceBus.TransportReceiver.<InvokePipeline>d__5.MoveNext()
at NServiceBus.TransportReceiver.<InvokePipeline>d__5.MoveNext()
at NServiceBus.LearningTransportMessagePump.<ProcessFile>d__10.MoveNext()
NServiceBus.FailedQ = HeaderWriterErrorV7
NServiceBus.MessageId = 49b3223e-4099-4345-b491-ae45015f4401
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterErrorV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ProcessingEndpoint = HeaderWriterErrorV7
NServiceBus.ProcessingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterErrorV7
NServiceBus.TimeOfFailure = 2022-02-23 21:18:55:269001 Z
NServiceBus.TimeSent = 2022-02-23 21:18:55:144867 Z
NServiceBus.Version = 7.7.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 = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = ccf33a23-3bc7-4f0b-8d10-ae45015f43bc
NServiceBus.CorrelationId = d318dcec-dc23-4d30-9c6b-ae45015f43bc
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = d318dcec-dc23-4d30-9c6b-ae45015f43bc
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterEncryptionV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterEncryptionV7
NServiceBus.TimeSent = 2022-02-23 21:18:54:915544 Z
NServiceBus.Version = 7.7.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>
File share data bus headers
When using the file share data bus, 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 = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = ad5df318-42b8-4fbd-8f0b-ae45015f4207
NServiceBus.CorrelationId = 23d7741c-dbe8-4a1e-aa56-ae45015f4207
NServiceBus.DataBus.2022-02-23_15\12ed07f2-96f9-4006-a774-2f147042bc88 = 2022-02-23_15\12ed07f2-96f9-4006-a774-2f147042bc88
NServiceBus.DataBus.2022-02-23_15\870413a3-44ea-4ba1-ae40-e93c406208f8 = 2022-02-23_15\870413a3-44ea-4ba1-ae40-e93c406208f8
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 23d7741c-dbe8-4a1e-aa56-ae45015f4207
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterDataBusPropertyV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterDataBusPropertyV7
NServiceBus.TimeSent = 2022-02-23 21:18:53:464596 Z
NServiceBus.Version = 7.7.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>2022-02-23_15\12ed07f2-96f9-4006-a774-2f147042bc88</Key><HasValue>true</HasValue></LargeProperty1><LargeProperty2><Key>2022-02-23_15\870413a3-44ea-4ba1-ae40-e93c406208f8</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 = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 5cfe002c-647a-42bc-a911-ae45015f41c1
NServiceBus.CorrelationId = a0472e36-6739-4d59-9bda-ae45015f41c1
NServiceBus.DataBus.Core7.Headers.Writers.MyNamespace.MessageToSend.LargeProperty1 = 2022-02-23_15\047d9bd7-69d4-47e2-9d40-6f89db232809
NServiceBus.DataBus.Core7.Headers.Writers.MyNamespace.MessageToSend.LargeProperty2 = 2022-02-23_15\e2baee78-fa4c-4e33-bb3a-91369cc6ed7f
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = a0472e36-6739-4d59-9bda-ae45015f41c1
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterDataBusConventionV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterDataBusConventionV7
NServiceBus.TimeSent = 2022-02-23 21:18:53:255610 Z
NServiceBus.Version = 7.7.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>