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 = bf0498cf-1ecc-4cdd-8245-ae45015f3f38
NServiceBus.CorrelationId = 982d3269-24ca-41cd-9d86-ae45015f3f38
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 982d3269-24ca-41cd-9d86-ae45015f3f38
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterSendV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterSendV8
NServiceBus.TimeSent = 2022-02-23 21:18:51:063736 Z
NServiceBus.Version = 8.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
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 = f53ba6fe8bda20bf14f7bbe5dd46ef5b
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 000345c8-9d7a-4375-a0e6-ab2900b53d78
NServiceBus.CorrelationId = 97f060a4-390f-4c5c-9e94-ab2900b53d77
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 97f060a4-390f-4c5c-9e94-ab2900b53d77
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterReplyV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterReplyV7
NServiceBus.TimeSent = 2019-12-20 10:59:52:504138 Z
NServiceBus.Version = 7.2.0
the headers of the reply message will be:
$.diagnostics.originating.hostid = f53ba6fe8bda20bf14f7bbe5dd46ef5b
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 000345c8-9d7a-4375-a0e6-ab2900b53d78
NServiceBus.CorrelationId = 97f060a4-390f-4c5c-9e94-ab2900b53d77
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToReply, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = e3e519c4-c66a-4f4a-adb9-ab2900b53d7f
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterReplyV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.RelatedTo = 97f060a4-390f-4c5c-9e94-ab2900b53d77
NServiceBus.ReplyToAddress = HeaderWriterReplyV7
NServiceBus.TimeSent = 2019-12-20 10:59:52:533138 Z
NServiceBus.Version = 7.2.0
Publish headers
When a message is published the headers will be as follows:
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 9df9cfbf-11f9-417c-8709-ae45015f3d98
NServiceBus.CorrelationId = d5da1f70-7e75-4ade-8ac8-ae45015f3d97
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.MessageToPublish, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = d5da1f70-7e75-4ade-8ac8-ae45015f3d97
NServiceBus.MessageIntent = Publish
NServiceBus.OriginatingEndpoint = HeaderWriterPublishV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterPublishV8
NServiceBus.TimeSent = 2022-02-23 21:18:49:674562 Z
NServiceBus.Version = 8.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.
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 = f53ba6fe8bda20bf14f7bbe5dd46ef5b
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = fcb72aa5-5f57-4614-afb4-ab2900b53d95
NServiceBus.CorrelationId = 55f391e4-06bd-491e-8946-ab2900b53d94
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 55f391e4-06bd-491e-8946-ab2900b53d94
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterReturnV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterReturnV7
NServiceBus.TimeSent = 2019-12-20 10:59:52:602139 Z
NServiceBus.Version = 7.2.0
the headers of reply message will be:
$.diagnostics.originating.hostid = f53ba6fe8bda20bf14f7bbe5dd46ef5b
NServiceBus.ControlMessage = True
NServiceBus.ConversationId = fcb72aa5-5f57-4614-afb4-ab2900b53d95
NServiceBus.CorrelationId = 55f391e4-06bd-491e-8946-ab2900b53d94
NServiceBus.MessageId = 36a6df94-78dc-425b-8fb3-ab2900b53d9b
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterReturnV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.RelatedTo = 55f391e4-06bd-491e-8946-ab2900b53d94
NServiceBus.ReplyToAddress = HeaderWriterReturnV7
NServiceBus.ReturnMessage.ErrorCode = 100
NServiceBus.TimeSent = 2019-12-20 10:59:52:627638 Z
NServiceBus.Version = 7.2.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 = 96f2272c-921e-43be-be37-ae45015f3e67
NServiceBus.CorrelationId = cd356d85-b4b5-44f4-8c21-ae45015f3e67
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.SendFromSagaMessage, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 7de772d7-43b2-4fb7-9fba-ae45015f3e99
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterSagaV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.OriginatingSagaId = 9782ed1b-6fdc-d722-97f6-44d8f67d430c
NServiceBus.OriginatingSagaType = Core9.Headers.Writers.MyNamespace.Saga1, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.RelatedTo = cd356d85-b4b5-44f4-8c21-ae45015f3e67
NServiceBus.ReplyToAddress = HeaderWriterSagaV8
NServiceBus.TimeSent = 2022-02-23 21:18:50:531601 Z
NServiceBus.Version = 8.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
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 = 96f2272c-921e-43be-be37-ae45015f3e67
NServiceBus.CorrelationId = cd356d85-b4b5-44f4-8c21-ae45015f3e67
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.ReplyFromSagaMessage, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 25a5e189-2423-4406-8dcc-ae45015f3ee3
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterSagaV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.OriginatingSagaId = 1ac2496d-e049-fe47-b3e0-9a82d862e864
NServiceBus.OriginatingSagaType = Core9.Headers.Writers.MyNamespace.Saga2, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.RelatedTo = 7de772d7-43b2-4fb7-9fba-ae45015f3e99
NServiceBus.ReplyToAddress = HeaderWriterSagaV8
NServiceBus.SagaId = 9782ed1b-6fdc-d722-97f6-44d8f67d430c
NServiceBus.SagaType = Core9.Headers.Writers.MyNamespace.Saga1, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.TimeSent = 2022-02-23 21:18:50:784641 Z
NServiceBus.Version = 8.0.0
Via calling Saga.ReplyToOriginator
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 96f2272c-921e-43be-be37-ae45015f3e67
NServiceBus.CorrelationId = 7de772d7-43b2-4fb7-9fba-ae45015f3e99
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.ReplyToOriginatorFromSagaMessage, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 5107847a-c95b-4780-a89a-ae45015f3ee6
NServiceBus.MessageIntent = Reply
NServiceBus.OriginatingEndpoint = HeaderWriterSagaV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.OriginatingSagaId = 1ac2496d-e049-fe47-b3e0-9a82d862e864
NServiceBus.OriginatingSagaType = Core9.Headers.Writers.MyNamespace.Saga2, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.RelatedTo = 7de772d7-43b2-4fb7-9fba-ae45015f3e99
NServiceBus.ReplyToAddress = HeaderWriterSagaV8
NServiceBus.TimeSent = 2022-02-23 21:18:50:786655 Z
NServiceBus.Version = 8.0.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 = 4e6a4071-a5e6-4808-9c48-ae45015f3851
NServiceBus.CorrelationId = 925c4895-a6e4-4f09-b9ad-ae45015f3850
NServiceBus.DeliverAt = 2022-02-23 21:18:45:182746 Z
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 925c4895-a6e4-4f09-b9ad-ae45015f3850
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterDeferV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterDeferV8
NServiceBus.TimeSent = 2022-02-23 21:18:45:172746 Z
NServiceBus.Version = 8.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.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 = 9fee968e-2ea0-4f55-80fe-ae45015f3678
NServiceBus.CorrelationId = 8b57ed09-31d4-48f5-9da8-ae45015f3674
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 8b57ed09-31d4-48f5-9da8-ae45015f3674
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterAuditV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterAuditV8
NServiceBus.TimeSent = 2022-02-23 21:18:43:635321 Z
NServiceBus.Version = 8.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 = 5fc2d3fe172c2602b7e1b665f355aa9d
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 9fee968e-2ea0-4f55-80fe-ae45015f3678
NServiceBus.CorrelationId = 8b57ed09-31d4-48f5-9da8-ae45015f3674
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 8b57ed09-31d4-48f5-9da8-ae45015f3674
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterAuditV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ProcessingEnded = 2022-02-23 21:18:44:124566 Z
NServiceBus.ProcessingEndpoint = HeaderWriterAuditV8
NServiceBus.ProcessingMachine = MACHINENAME
NServiceBus.ProcessingStarted = 2022-02-23 21:18:44:044364 Z
NServiceBus.ReplyToAddress = HeaderWriterAuditV8
NServiceBus.TimeSent = 2022-02-23 21:18:43:635321 Z
NServiceBus.Version = 8.0.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 = bac2a1e2-d728-4b11-8e47-ae45015f39d8
NServiceBus.CorrelationId = e29ef002-6264-46e3-a24c-ae45015f39d7
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = e29ef002-6264-46e3-a24c-ae45015f39d7
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterErrorV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterErrorV8
NServiceBus.TimeSent = 2022-02-23 21:18:46:473645 Z
NServiceBus.Version = 8.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 = 5fc2d3fe172c2602b7e1b665f355aa9d
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = bac2a1e2-d728-4b11-8e47-ae45015f39d8
NServiceBus.CorrelationId = e29ef002-6264-46e3-a24c-ae45015f39d7
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.ExceptionInfo.Data.Handler canceled = False
NServiceBus.ExceptionInfo.Data.Handler failure time = 2022-02-23 21:18:46:553639 Z
NServiceBus.ExceptionInfo.Data.Handler start time = 2022-02-23 21:18:46:553639 Z
NServiceBus.ExceptionInfo.Data.Handler type = Core9.Headers.Writers.MyNamespace.MessageHandler
NServiceBus.ExceptionInfo.Data.Message ID = e29ef002-6264-46e3-a24c-ae45015f39d7
NServiceBus.ExceptionInfo.Data.Message type = Core9.Headers.Writers.MyNamespace.MessageToSend
NServiceBus.ExceptionInfo.Data.Pipeline canceled = False
NServiceBus.ExceptionInfo.Data.Transport message ID = 017fe38f-aea6-4cfa-8fba-9bcedb45b9a6
NServiceBus.ExceptionInfo.ExceptionType = System.Exception
NServiceBus.ExceptionInfo.HelpLink =
NServiceBus.ExceptionInfo.Message = The exception message from the handler.
NServiceBus.ExceptionInfo.Source = Core_8
NServiceBus.ExceptionInfo.StackTrace = System.Exception: The exception message from the handler.
at Core9.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.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.LearningTransportMessagePump.<ProcessFile>d__23.MoveNext()
NServiceBus.FailedQ = HeaderWriterErrorV8
NServiceBus.MessageId = e29ef002-6264-46e3-a24c-ae45015f39d7
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterErrorV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ProcessingEndpoint = HeaderWriterErrorV8
NServiceBus.ProcessingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterErrorV8
NServiceBus.TimeOfFailure = 2022-02-23 21:18:46:553639 Z
NServiceBus.TimeSent = 2022-02-23 21:18:46:473645 Z
NServiceBus.Version = 8.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 = f53ba6fe8bda20bf14f7bbe5dd46ef5b
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = 164b4007-f6cd-4419-bad0-ab2900b5396f
NServiceBus.CorrelationId = 47ac3a2b-192d-430b-a345-ab2900b5396f
NServiceBus.EnclosedMessageTypes = Core7.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 47ac3a2b-192d-430b-a345-ab2900b5396f
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterEncryptionV7
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterEncryptionV7
NServiceBus.TimeSent = 2019-12-20 10:59:49:062894 Z
NServiceBus.Version = 7.2.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.
The payload content-type is captured in the header NServiceBus.
.
Example headers
$.diagnostics.originating.hostid = 5fc2d3fe172c2602b7e1b665f355aa9d
NServiceBus.ContentType = text/xml
NServiceBus.ConversationId = f73a509a-de58-46e7-9a9c-ae45015f3819
NServiceBus.CorrelationId = b59a8a4e-829f-4ccb-aa68-ae45015f3819
NServiceBus.DataBus.2022-02-23_21\45a85154-ffe8-45dd-b72b-2970023c40f9 = 2022-02-23_21\45a85154-ffe8-45dd-b72b-2970023c40f9
NServiceBus.DataBus.2022-02-23_21\76320bc6-b287-4138-92f9-8bfdf40b67e5 = 2022-02-23_21\76320bc6-b287-4138-92f9-8bfdf40b67e5
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = b59a8a4e-829f-4ccb-aa68-ae45015f3819
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterDataBusPropertyV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterDataBusPropertyV8
NServiceBus.TimeSent = 2022-02-23 21:18:44:991734 Z
NServiceBus.Version = 8.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/Core9.Headers.Writers"><LargeProperty1><Key>2022-02-23_21\45a85154-ffe8-45dd-b72b-2970023c40f9</Key><HasValue>true</HasValue></LargeProperty1><LargeProperty2><Key>2022-02-23_21\76320bc6-b287-4138-92f9-8bfdf40b67e5</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 = 3f7c592c-a4d2-4ad6-b1a3-ae45015f37de
NServiceBus.CorrelationId = 4d98349a-4c82-44d9-8130-ae45015f37de
NServiceBus.DataBus.Core9.Headers.Writers.MyNamespace.MessageToSend.LargeProperty1 = 2022-02-23_21\686b5074-2138-4a69-aca2-831cc733fe61
NServiceBus.DataBus.Core9.Headers.Writers.MyNamespace.MessageToSend.LargeProperty2 = 2022-02-23_21\b89492db-e1ce-45a4-abca-5308863e1535
NServiceBus.EnclosedMessageTypes = Core9.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
NServiceBus.MessageId = 4d98349a-4c82-44d9-8130-ae45015f37de
NServiceBus.MessageIntent = Send
NServiceBus.OriginatingEndpoint = HeaderWriterDataBusConventionV8
NServiceBus.OriginatingMachine = MACHINENAME
NServiceBus.ReplyToAddress = HeaderWriterDataBusConventionV8
NServiceBus.TimeSent = 2022-02-23 21:18:44:822640 Z
NServiceBus.Version = 8.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/Core9.Headers.Writers"></MessageToSend>