# Message Headers 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](/nservicebus/messaging/header-manipulation.md). ## 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 `DateTimeOffsetHelper` supports converting from UTC to wire format and vice versa by using the `ToWireFormattedString(DateTimeOffset)` and `ToDateTimeOffset(string)` methods. ### ISO 8601 format This is NOT the [ISO 8601 format](https://nl.wikipedia.org/wiki/ISO_8601) but a custom format. Differences: 1. a `T` between date and time 2. uses a `.` between seconds and milli/microseconds 3. no space between the timestamp and the `Z` ``` ISO 8601: yyyy-MM-ddTHH:mm:ss.ffffffZ NServiceBus: yyyy-MM-dd HH:mm:ss:ffffff Z ``` When doing native intergration and there is a need to parse the timestamp the `.` as second and milli/microsecond separator is where regular timestamp parsers often fail. ## Transport headers ### NServiceBus.NonDurableMessage The `NonDurableMessage` header controls [non-durable messaging](non-durable-messaging.md) 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](discard-old-messages.md). The behavior is transport-dependent. ### NServiceBus.Transport.Encoding States what type of body serialization is used. It is used only by the legacy Azure Service Bus transport (`NServiceBus.Azure.Transports.WindowsAzureServiceBus` package), which is no longer supported. ## Serialization headers The following headers include information for the receiving endpoint on the [message serialization](/nservicebus/serialization/index.md) option that was used. ### NServiceBus.ContentType The type of serialization used for the message, for example, `text/xml`, `text/json`, `application/json`, or `application/json; systemjson`. In some cases, the `NServiceBus.Version` header may be useful for determining how to use the value in this header appropriately. > [!WARNING] > Although this header mimicks the [HTTP Content-Type header](https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type) 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/json; systemjson`). ### 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](/samples/versioning/index.md) 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](/nservicebus/messaging/message-type-detection.md) for more details. ## Messaging interaction headers The following headers enable different messaging interaction patterns, such as Request-Response. ### NServiceBus.MessageId A [unique ID for the current message](/nservicebus/messaging/message-identity.md). ### NServiceBus.CorrelationId NServiceBus implements the [Correlation Identifier](https://www.enterpriseintegrationpatterns.com/patterns/messaging/CorrelationIdentifier.html) 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](/nservicebus/messaging/callbacks.md). Messages sent from a [saga](/nservicebus/sagas/index.md) 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](/nservicebus/sagas/index.md#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 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 [ServicePulse](/servicepulse/message-details.md#messages-with-audited-conversation-data-flow-diagram) 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, the `OrderId` can be used as the `ConversationId`. Manually assigning a `ConversationId` to the message being sent can be achieved by overriding the header with a custom value: ```cs var sendOptions = new SendOptions(); sendOptions.SetHeader(Headers.ConversationId, "MyCustomConversationId/" + System.Guid.NewGuid()); await context.Send(new MyMessage(), sendOptions); ``` To get full control over the `ConversationId`, a custom convention can be registered: ```cs 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 will automatically be invoked for all sent messages so they use the custom `ConversationId`, and it no longer needs to be manually set for each individual message. This approach is useful when a given rule or custom attribute should be applied to all sent messages. > [!NOTE] > This is not invoked for incoming messages. > [!WARNING] > 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'). > ``` > [!NOTE] > `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: ```cs var sendOptions = new SendOptions(); sendOptions.StartNewConversation(); await context.Send(new CancelOrder(), sendOptions); ``` A custom `Conversation ID` can also be provided: ```cs 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 being handled. > [!NOTE] > For a single request-response interaction, `Correlation Id` and `RelatedTo` are very similar. Both headers can correlate the response message back to the request message. Once a _conversation_ is longer than a single request-response interaction, `Correlation Id` can correlate a response to the original request. `RelatedTo` can only correlate a message 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](#messaging-interaction-headers-nservicebus-messageintent) indicating that the source endpoint wants to subscribe to a specific message. | | Unsubscribe | A [control message](#messaging-interaction-headers-nservicebus-messageintent) indicating that the source endpoint wants 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, i.e., it has no body, and the intent of the message and any data are transmitted in the message headers. ### NServiceBus.ReplyToAddress Downstream message [handlers](/nservicebus/handlers/index.md) or [sagas](/nservicebus/sagas/index.md) 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: ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = be608f89-50d0-40b4-be96-b33b000c1b8e NServiceBus.CorrelationId = d6c158b7-226a-44f6-951f-b33b000c1b8e NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = d6c158b7-226a-44f6-951f-b33b000c1b8e NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterSend NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterSend NServiceBus.TimeSent = 2025-08-16 00:44:04:954582 Z NServiceBus.Version = 8.2.5 ``` In the above example, the headers are for a Send operation, 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 the same as the initiating `CorrelationId`. ### Example reply headers Given an initiating message with the following headers: ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 20c475ca-b626-4e5c-b0ec-b33b000c1b68 NServiceBus.CorrelationId = 371bc5d3-1f66-4280-acb6-b33b000c1b68 NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 371bc5d3-1f66-4280-acb6-b33b000c1b68 NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterReply NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterReply NServiceBus.TimeSent = 2025-08-16 00:44:04:828893 Z NServiceBus.Version = 8.2.5 ``` The headers of the reply message will be: ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 20c475ca-b626-4e5c-b0ec-b33b000c1b68 NServiceBus.CorrelationId = 371bc5d3-1f66-4280-acb6-b33b000c1b68 NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToReply, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = ba34a45f-5738-4ee8-b0e2-b33b000c1b6c NServiceBus.MessageIntent = Reply NServiceBus.OriginatingEndpoint = HeaderWriterReply NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.RelatedTo = 371bc5d3-1f66-4280-acb6-b33b000c1b68 NServiceBus.ReplyToAddress = HeaderWriterReply NServiceBus.TimeSent = 2025-08-16 00:44:04:843417 Z NServiceBus.Version = 8.2.5 ``` ## Publish headers When a message is published, the headers will be as follows: ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 2d55209a-f4fb-4984-84cf-b33b000c1b4b NServiceBus.CorrelationId = 5fb721f2-d442-4a21-86b1-b33b000c1b4b NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToPublish, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 5fb721f2-d442-4a21-86b1-b33b000c1b4b NServiceBus.MessageIntent = Publish NServiceBus.OriginatingEndpoint = HeaderWriterPublish NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterPublish NServiceBus.TimeSent = 2025-08-16 00:44:04:735032 Z NServiceBus.Version = 8.2.5 ``` ## Return from a handler When returning a message instead of replying: * The Return has the same points as the Reply example above but with some additions. * The `ReturnMessage.ErrorCode` contains the value supplied to the `Bus.Return` method. ### Example return headers Given an initiating message with the following headers: ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = eea478ff-9979-407a-a867-b33b000c1b73 NServiceBus.CorrelationId = 6be07687-b0b1-46ef-a3a2-b33b000c1b73 NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 6be07687-b0b1-46ef-a3a2-b33b000c1b73 NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterReturn NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterReturn NServiceBus.TimeSent = 2025-08-16 00:44:04:867146 Z NServiceBus.Version = 8.2.5 ``` The headers of the reply message will be: ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ControlMessage = True NServiceBus.ConversationId = eea478ff-9979-407a-a867-b33b000c1b73 NServiceBus.CorrelationId = 6be07687-b0b1-46ef-a3a2-b33b000c1b73 NServiceBus.MessageId = 631e455f-ce7b-480b-b403-b33b000c1b77 NServiceBus.MessageIntent = Reply NServiceBus.OriginatingEndpoint = HeaderWriterReturn NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.RelatedTo = 6be07687-b0b1-46ef-a3a2-b33b000c1b73 NServiceBus.ReplyToAddress = HeaderWriterReturn NServiceBus.ReturnMessage.ErrorCode = 100 NServiceBus.TimeSent = 2025-08-16 00:44:04:879297 Z NServiceBus.Version = 8.2.5 ``` ## Timeout headers ### NServiceBus.ClearTimeouts This is a header to indicate that the contained [control message](#messaging-interaction-headers-nservicebus-messageintent) requests 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 to which a timeout should be routed back to when it expires. ### NServiceBus.IsDeferredMessage A header to indicate that this message resulted from a message deferral. ## Saga-related headers When a message is dispatched from within a saga, the message will contain the following headers: * `OriginatingSagaId`: matches the ID used as the index for the saga data stored in persistence. * `OriginatingSagaType`: the fully qualified type name of the saga that sent the message. ### Example "send from saga" headers ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 43997059-e583-4bdb-95f0-b33b000c1b80 NServiceBus.CorrelationId = 4bc6c185-7c84-404b-919d-b33b000c1b80 NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.SendFromSagaMessage, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 4e3ef7f5-692d-4d2d-b00c-b33b000c1b85 NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterSaga NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.OriginatingSagaId = 93c29a5f-c773-0685-2b5f-357322b66f50 NServiceBus.OriginatingSagaType = Core.Headers.Writers.MyNamespace.Saga1, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.RelatedTo = 4bc6c185-7c84-404b-919d-b33b000c1b80 NServiceBus.ReplyToAddress = HeaderWriterSaga NServiceBus.TimeSent = 2025-08-16 00:44:04:925177 Z NServiceBus.Version = 8.2.5 ``` ### 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 standard reply header 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 the initial saga, the headers will contain `SagaId` and `SagaType` headers matching the initial saga. ### Example "replying to a saga" headers #### Via calling Bus.Reply ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 43997059-e583-4bdb-95f0-b33b000c1b80 NServiceBus.CorrelationId = 4bc6c185-7c84-404b-919d-b33b000c1b80 NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.ReplyFromSagaMessage, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 40dfdb97-e8b8-4f5f-b6a3-b33b000c1b87 NServiceBus.MessageIntent = Reply NServiceBus.OriginatingEndpoint = HeaderWriterSaga NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.OriginatingSagaId = 5fc7ff54-8683-25a3-70b3-cb9b0dec38ab NServiceBus.OriginatingSagaType = Core.Headers.Writers.MyNamespace.Saga2, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.RelatedTo = 4e3ef7f5-692d-4d2d-b00c-b33b000c1b85 NServiceBus.ReplyToAddress = HeaderWriterSaga NServiceBus.SagaId = 93c29a5f-c773-0685-2b5f-357322b66f50 NServiceBus.SagaType = Core.Headers.Writers.MyNamespace.Saga1, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.TimeSent = 2025-08-16 00:44:04:930882 Z NServiceBus.Version = 8.2.5 ``` #### Via calling Saga.ReplyToOriginator ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 43997059-e583-4bdb-95f0-b33b000c1b80 NServiceBus.CorrelationId = 4e3ef7f5-692d-4d2d-b00c-b33b000c1b85 NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.ReplyToOriginatorFromSagaMessage, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = e48b0886-51ca-4b50-a6cd-b33b000c1b87 NServiceBus.MessageIntent = Reply NServiceBus.OriginatingEndpoint = HeaderWriterSaga NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.OriginatingSagaId = 5fc7ff54-8683-25a3-70b3-cb9b0dec38ab NServiceBus.OriginatingSagaType = Core.Headers.Writers.MyNamespace.Saga2, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.RelatedTo = 4e3ef7f5-692d-4d2d-b00c-b33b000c1b85 NServiceBus.ReplyToAddress = HeaderWriterSaga NServiceBus.TimeSent = 2025-08-16 00:44:04:931311 Z NServiceBus.Version = 8.2.5 ``` ### 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 ```txt $.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 ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 96a927c1-158f-4abc-a6f9-b33b000c1675 NServiceBus.CorrelationId = 228ed623-a00d-43d7-b1c7-b33b000c1675 NServiceBus.DeliverAt = 2025-08-16 00:44:00:614359 Z NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 228ed623-a00d-43d7-b1c7-b33b000c1675 NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterDefer NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterDefer NServiceBus.TimeSent = 2025-08-16 00:44:00:604359 Z NServiceBus.Version = 8.2.5 ``` ## Diagnostic and informational headers Headers used to give visibility into the "where," "when," and "by whom" of a message. They are used by [ServiceControl](/servicecontrol/index.md) and [ServicePulse](/servicepulse/index.md). ### $.diagnostics The [host details](/nservicebus/hosting/override-hostid.md) 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](/monitoring/metrics/performance-counters.md). ### NServiceBus.DeliverAt The timestamp when the message should be delivered. Used for more accurate calculation of [critical time](/monitoring/metrics/definitions.md#metrics-captured-critical-time). ### NServiceBus.OriginatingEndpoint The endpoint name the message was sent from. > [!NOTE] > Used for linking messages in ServicePulse. See [NServiceBus.ConversationId](#messaging-interaction-headers-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](/nservicebus/operations/opentelemetry.md) is enabled for an endpoint, in accordance with the [W3C Trace Context specification](https://www.w3.org/TR/trace-context): * [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header) * [`tracestate`](https://www.w3.org/TR/trace-context/#tracestate-header) * [`baggage`](https://www.w3.org/TR/baggage/#baggage-http-header-format) ## Audit headers Headers added when a message is [audited](/nservicebus/operations/auditing.md). ### NServiceBus.ProcessingEnded The timestamp when the processing of a message ended. ### NServiceBus.ProcessingEndpoint Name of the endpoint where the message was processed. > [!NOTE] > Used for linking messages in ServicePulse. See [NServiceBus.ConversationId](#messaging-interaction-headers-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: ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 1d497240-d78e-4eb7-9a45-b33b000be46e NServiceBus.CorrelationId = fdd6ce75-bd90-4d0f-9532-b33b000be46e NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = fdd6ce75-bd90-4d0f-9532-b33b000be46e NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterAudit NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterAudit NServiceBus.TimeSent = 2025-08-16 00:43:17:921454 Z NServiceBus.Version = 8.2.5 ``` when that message fails to be processed, it will be sent to the error queue with the following headers: ```txt $.diagnostics.hostdisplayname = MACHINENAME $.diagnostics.hostid = 7f787fc8e0611a3fab8a93c8767f6639 $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 32391968-beb3-49ee-999c-b33b000b7359 NServiceBus.CorrelationId = 565726b8-b396-46c9-808c-b33b000b7359 NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 565726b8-b396-46c9-808c-b33b000b7359 NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterAudit NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ProcessingEnded = 2025-08-16 00:43:17:936312 Z NServiceBus.ProcessingEndpoint = HeaderWriterAudit NServiceBus.ProcessingMachine = MACHINENAME NServiceBus.ProcessingStarted = 2025-08-16 00:43:17:926084 Z NServiceBus.ReplyToAddress = HeaderWriterAudit NServiceBus.TimeSent = 2025-08-16 00:41:41:424201 Z NServiceBus.Version = 8.2.5 ``` ## Retries handling headers Headers used to facilitate [retries](/nservicebus/recoverability/index.md). > [!NOTE] > 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](/nservicebus/recoverability/index.md#delayed-retries) that have been performed for a message. ### NServiceBus.Retries.Timestamp A timestamp used by [delayed retries](/nservicebus/recoverability/index.md#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](/nservicebus/recoverability/index.md) 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](https://msdn.microsoft.com/en-us/library/system.type.fullname.aspx) of the Exception. It is obtained by calling `Exception.GetType().FullName`. ### NServiceBus.ExceptionInfo.InnerExceptionType The full type name of the [InnerException](https://msdn.microsoft.com/en-us/library/system.exception.innerexception.aspx) if it exists. It is obtained by calling `Exception.InnerException.GetType().FullName`. ### NServiceBus.ExceptionInfo.HelpLink The [exception help link](https://msdn.microsoft.com/en-us/library/system.exception.helplink.aspx). ### NServiceBus.ExceptionInfo.Message The [exception message](https://msdn.microsoft.com/en-us/library/system.exception.message.aspx). ### NServiceBus.ExceptionInfo.Source The [exception source](https://msdn.microsoft.com/en-us/library/system.exception.source.aspx). ### NServiceBus.ExceptionInfo.StackTrace The [exception stack trace](https://msdn.microsoft.com/en-us/library/system.exception.stacktrace.aspx). ### Example error headers Given an initiating message with the following headers: ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 1df93f45-324e-43b4-88c5-b33b000cea14 NServiceBus.CorrelationId = 3a70adf2-2ade-430b-a91b-b33b000cea13 NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 3a70adf2-2ade-430b-a91b-b33b000cea13 NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterError NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterError NServiceBus.TimeSent = 2025-08-16 00:47:01:191801 Z NServiceBus.Version = 8.2.5 ``` when that message fails to be processed, it will be sent to the error queue with the following headers: ```txt $.diagnostics.hostdisplayname = MACHINENAME $.diagnostics.hostid = 7f787fc8e0611a3fab8a93c8767f6639 $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = 1df93f45-324e-43b4-88c5-b33b000cea14 NServiceBus.CorrelationId = 3a70adf2-2ade-430b-a91b-b33b000cea13 NServiceBus.EnclosedMessageTypes = Core.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 = 2025-08-16 00:47:01:229390 Z NServiceBus.ExceptionInfo.Data.Handler start time = 2025-08-16 00:47:01:229345 Z NServiceBus.ExceptionInfo.Data.Handler type = Core.Headers.Writers.MyNamespace.MessageHandler NServiceBus.ExceptionInfo.Data.Message ID = 3a70adf2-2ade-430b-a91b-b33b000cea13 NServiceBus.ExceptionInfo.Data.Message type = Core.Headers.Writers.MyNamespace.MessageToSend NServiceBus.ExceptionInfo.Data.Pipeline canceled = False NServiceBus.ExceptionInfo.Data.Transport message ID = f7caf811-b0ec-473d-9fa2-8d063596f482 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 Core.Headers.Writers.HeaderWriterError.MessageHandler.Handle(MessageToSend message, IMessageHandlerContext context) at NServiceBus.Pipeline.MessageHandler.Invoke(Object message, IMessageHandlerContext handlerContext) at NServiceBus.InvokeHandlerTerminator.Terminate(IInvokeHandlerContext context) at NServiceBus.LoadHandlersConnector.Invoke(IIncomingLogicalMessageContext context, Func2 stage) at NServiceBus.DeserializeMessageConnector.Invoke(IIncomingPhysicalMessageContext context, Func2 stage) at NServiceBus.ProcessingStatisticsBehavior.Invoke(IIncomingPhysicalMessageContext context, Func2 next) at NServiceBus.TransportReceiveToPhysicalMessageConnector.Invoke(ITransportReceiveContext context, Func2 next) at NServiceBus.RetryAcknowledgementBehavior.Invoke(ITransportReceiveContext context, Func2 next) at NServiceBus.MainPipelineExecutor.Invoke(MessageContext messageContext, CancellationToken cancellationToken) at NServiceBus.MainPipelineExecutor.Invoke(MessageContext messageContext, CancellationToken cancellationToken) at NServiceBus.LearningTransportMessagePump.ProcessFile(ILearningTransportTransaction transaction, String messageId, CancellationToken messageProcessingCancellationToken) NServiceBus.FailedQ = HeaderWriterError NServiceBus.MessageId = 3a70adf2-2ade-430b-a91b-b33b000cea13 NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterError NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ProcessingEndpoint = HeaderWriterError NServiceBus.ProcessingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterError NServiceBus.TimeOfFailure = 2025-08-16 00:47:01:230083 Z NServiceBus.TimeSent = 2025-08-16 00:47:01:191801 Z NServiceBus.Version = 8.2.5 ``` ## Encryption headers Headers when using [message property encryption](/nservicebus/security/property-encryption.md). ### NServiceBus.RijndaelKeyIdentifier Identifies the encryption key used for encryption of the message property fragments. #### Example headers ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = be00dc70-7cd1-4acb-8710-b33b000c17b9 NServiceBus.CorrelationId = 4b521f1f-be09-479b-883a-b33b000c17b9 NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 4b521f1f-be09-479b-883a-b33b000c17b9 NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterEncryption NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterEncryption NServiceBus.TimeSent = 2025-08-16 00:44:01:685015 Z NServiceBus.Version = 8.2.5 ``` #### Example body ```txt String 1String 2 ``` ## File share data bus headers When using the [file share data bus](/nservicebus/messaging/claimcheck/file-share.md), 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.DataBusConfig.ContentType`. #### Example headers ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = bf455337-dab9-4dee-bd64-b33b000c165d NServiceBus.CorrelationId = 52a1bb93-cff3-4833-8649-b33b000c165d NServiceBus.DataBus.2025-08-16_00/09710903-c8f2-4479-b163-13e8c4ec1986 = 2025-08-16_00/09710903-c8f2-4479-b163-13e8c4ec1986 NServiceBus.DataBus.2025-08-16_00/c2314913-c563-45b6-b023-d108678479f9 = 2025-08-16_00/c2314913-c563-45b6-b023-d108678479f9 NServiceBus.DataBusConfig.ContentType = application/json NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 52a1bb93-cff3-4833-8649-b33b000c165d NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterDataBusProperty NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterDataBusProperty NServiceBus.TimeSent = 2025-08-16 00:44:00:524571 Z NServiceBus.Version = 8.2.5 ``` #### Example body ```txt 2025-08-16_00/c2314913-c563-45b6-b023-d108678479f9true2025-08-16_00/09710903-c8f2-4479-b163-13e8c4ec1986true ``` ### Using conventions When using [conventions](/nservicebus/messaging/conventions.md) 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 ```txt $.diagnostics.originating.hostid = 7f787fc8e0611a3fab8a93c8767f6639 NServiceBus.ContentType = text/xml NServiceBus.ConversationId = d61ae79e-e5ce-4bda-b83f-b33b000c1647 NServiceBus.CorrelationId = 1c9c79e7-b522-42ab-9826-b33b000c1647 NServiceBus.DataBus.Core.Headers.Writers.MyNamespace.MessageToSend.LargeProperty1 = 2025-08-16_00/f2d449cb-17b5-47e6-9eb7-ff3e5f1976f3 NServiceBus.DataBus.Core.Headers.Writers.MyNamespace.MessageToSend.LargeProperty2 = 2025-08-16_00/8236990e-900c-4212-9723-9a1321735950 NServiceBus.DataBusConfig.ContentType = application/json NServiceBus.EnclosedMessageTypes = Core.Headers.Writers.MyNamespace.MessageToSend, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null NServiceBus.MessageId = 1c9c79e7-b522-42ab-9826-b33b000c1647 NServiceBus.MessageIntent = Send NServiceBus.OriginatingEndpoint = HeaderWriterDataBusConvention NServiceBus.OriginatingMachine = MACHINENAME NServiceBus.ReplyToAddress = HeaderWriterDataBusConvention NServiceBus.TimeSent = 2025-08-16 00:44:00:456601 Z NServiceBus.Version = 8.2.5 ``` #### Example body ```txt ``` ## ServiceControl ### ServiceControl.RetryTo Value: Queue name When present in a failed message to ServiceControl, ServiceControl will send the message to this queue instead of the queue name value from [NServiceBus.FailedQ](#error-forwarding-headers-nservicebus-failedq) This is used by the ServiceControl transport adapter to bridge failed messages between different transports. ### ServiceControl.TargetEndpointAddress Value: Queue name Used by the [messaging bridge](/nservicebus/bridge/index.md) to return failed messages back to the correct queue ### ServiceControl.Retry.AcknowledgementQueue Value: Queue name The queue to send an acknowledgement system message back to a specific ServiceControl queue to mark a retried message as processed. ### ServiceControl.Retry.Successful Contains a timestamp in the format `yyyy-MM-dd HH:mm:ss:ffffff Z` to indicate when a message was succesfully processed after a retry from ServiceControl. Part of the control message sent to ServiceControl to signal that a message was manually retried in ServicePulse/Control and flagged as processed successfully. ### ServiceControl.Retry.UniqueMessageId Contains the [NServiceBus.MessageId](#messaging-interaction-headers-nservicebus-messageid) value of the successfully processed message. Part of the control message send back to ServiceControl to signal that a message that was manually retried in ServicePulse/Control and flagged as processed successfully. The presence of any header key that starts with `ServiceControl.` indicates that the message has been retried from ServiceControl.