You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: nservicebus/messaging/headers.md
+62-40Lines changed: 62 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,8 +19,28 @@ The headers of a message are similar to HTTP headers and contain metadata about
19
19
20
20
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.
21
21
22
+
### ISO 8601 format
23
+
24
+
This is NOT the [ISO 8601 format](https://nl.wikipedia.org/wiki/ISO_8601) but a custom format.
25
+
26
+
Differences:
27
+
28
+
1. a `T` between date and time
29
+
2. uses a `.` between seconds and milli/microseconds
30
+
3. no space between the timestamp and the `Z`
31
+
32
+
33
+
```
34
+
ISO 8601: yyyy-MM-ddTHH:mm:ss.ffffffZ
35
+
NServiceBus: yyyy-MM-dd HH:mm:ss:ffffff Z
36
+
```
37
+
38
+
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.
39
+
40
+
Use the following code to generate or read our custom timestamp format.
41
+
22
42
```cs
23
-
conststringFormat="yyyy-MM-dd HH:mm:ss:ffffff Z";
43
+
conststringFormat="yyyy-MM-dd HH:mm:ss:ffffff Z";// Not ISO 8601
@@ -47,15 +67,19 @@ The `TimeToBeReceived` header [controls when a message becomes obsolete and can
47
67
48
68
### NServiceBus.Transport.Encoding
49
69
50
-
States what type of body serialization is used. Used only by the legacy Azure Service Bus transport which is no longer supported.
70
+
States what type of body serialization is used.
71
+
72
+
Used only by the legacy Azure Service Bus transport (`NServiceBus.Azure.Transports.WindowsAzureServiceBus` package) which is no longer supported.
51
73
52
74
## Serialization headers
53
75
54
76
The following headers include information for the receiving endpoint on the [message serialization](/nservicebus/serialization/) option that was used.
55
77
56
78
### NServiceBus.ContentType
57
79
58
-
The type of serialization used for the message, for example `text/xml`, `text/json`, `application/json`, or `application/json; systemjson`. In some cases, it may be useful to use the `NServiceBus.Version` header to determine how to use the value in this header appropriately.
80
+
The type of serialization used for the message, for example `text/xml`, `text/json`, `application/json`, or `application/json; systemjson`.
81
+
82
+
In some cases, it may be useful to use the `NServiceBus.Version` header to determine how to use the value in this header appropriately.
59
83
60
84
> [!WARNING]
61
85
> 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`).
@@ -64,8 +88,8 @@ The type of serialization used for the message, for example `text/xml`, `text/js
64
88
65
89
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/) the type can be specified in the following ways:
See the [message type detection documentation](/nservicebus/messaging/message-type-detection.md) for more details.
71
95
@@ -107,10 +131,9 @@ partial: conversationid
107
131
108
132
> [!WARNING]
109
133
> Attempting to override an existing Conversation ID is not supported and will produce the following error:
110
-
111
-
```
112
-
Cannot set the NServiceBus.ConversationId header to 'XXXXX' as it cannot override the incoming header value ('2f4076a0-d8de-4297-9d18-a830015dd42a').
113
-
```
134
+
> ```
135
+
> Cannot set the NServiceBus.ConversationId header to 'XXXXX' as it cannot override the incoming header value ('2f4076a0-d8de-4297-9d18-a830015dd42a').
136
+
> ```
114
137
115
138
> [!NOTE]
116
139
> `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(...)`).
@@ -130,13 +153,13 @@ The `MessageId` that caused the current message to be sent. Whenever a message i
130
153
131
154
Message intent can have one of the following values:
132
155
133
-
| Value | Description |
134
-
|-------------|-------------|
135
-
| Send |Regular point-to-point send. Note that messages sent to the error queue will also have a `Send` intent|
136
-
| Publish |The message is an event that has been published and will be sent to all subscribers.|
137
-
| Subscribe |A [control message](#messaging-interaction-headers-nservicebus-messageintent) indicating that the source endpoint would like to subscribe to a specific message.|
138
-
| Unsubscribe |A [control message](#messaging-interaction-headers-nservicebus-messageintent) indicating that the source endpoint would like to unsubscribe to a specific message.|
139
-
| Reply | The message has been initiated by doing a Reply or a Return from within a Handler or a Saga. |
| Send | Regular point-to-point send. Note that messages sent to the error queue will also have a `Send` intent|
159
+
| Publish | The message is an event that has been published and will be sent to all subscribers.|
160
+
| Subscribe | A [control message](#messaging-interaction-headers-nservicebus-messageintent) indicating that the source endpoint would like to subscribe to a specific message.|
161
+
| Unsubscribe |A [control message](#messaging-interaction-headers-nservicebus-messageintent) indicating that the source endpoint would like to unsubscribe to a specific message.|
162
+
| Reply | The message has been initiated by doing a Reply or a Return from within a Handler or a Saga. |
140
163
141
164
### NServiceBus.ControlMessage
142
165
@@ -160,10 +183,10 @@ In the above example, headers are for a Send and hence the `MessageIntent` heade
160
183
161
184
When replying to a message:
162
185
163
-
* The `MessageIntent` is `Reply`.
164
-
* The `RelatedTo` will be the same as the initiating `MessageID`.
165
-
* The `ConversationId` will be the same as the initiating `ConversationId`.
166
-
* The `CorrelationId` will be the same as the initiating `CorrelationId`.
186
+
* The `MessageIntent` is `Reply`.
187
+
* The `RelatedTo` will be the same as the initiating `MessageID`.
188
+
* The `ConversationId` will be the same as the initiating `ConversationId`.
189
+
* The `CorrelationId` will be the same as the initiating `CorrelationId`.
167
190
168
191
169
192
### Example reply headers
@@ -188,8 +211,8 @@ snippet: HeaderWriterPublish
188
211
189
212
When returning a message instead of replying:
190
213
191
-
* The Return has the same points as the Reply example above with some additions.
192
-
* The `ReturnMessage.ErrorCode` contains the value that was supplied to the `Bus.Return` method.
214
+
* The Return has the same points as the Reply example above with some additions.
215
+
* The `ReturnMessage.ErrorCode` contains the value that was supplied to the `Bus.Return` method.
193
216
194
217
195
218
### Example return headers
@@ -230,8 +253,8 @@ A header to indicate that this message resulted from a Defer.
230
253
231
254
When a message is dispatched from within a saga the message will contain the following:
232
255
233
-
* An `OriginatingSagaId` header which matches the ID used as the index for the saga data stored in persistence.
234
-
* An `OriginatingSagaType` which is the fully qualified type name of the saga that sent the message.
256
+
* An `OriginatingSagaId` header which matches the ID used as the index for the saga data stored in persistence.
257
+
* An `OriginatingSagaType` which is the fully qualified type name of the saga that sent the message.
* The `OriginatingSagaId`, `OriginatingSagaType`, `SagaId` and `SagaType` will all match the Saga that requested the Timeout.
269
-
* The `Timeout.RouteExpiredTimeoutTo` header contains the queue name for where the callback for the timeout should be sent.
270
-
* The `Timeout.Expire` header contains the timestamp for when the timeout should fire.
291
+
* The `OriginatingSagaId`, `OriginatingSagaType`, `SagaId` and `SagaType` will all match the Saga that requested the Timeout.
292
+
* The `Timeout.RouteExpiredTimeoutTo` header contains the queue name for where the callback for the timeout should be sent.
293
+
* The `Timeout.Expire` header contains the timestamp for when the timeout should fire.
271
294
272
295
273
296
#### Example timeout headers
@@ -293,9 +316,9 @@ Headers used to give visibility into "where", "when" and "by whom" of a message.
293
316
294
317
The [host details](/nservicebus/hosting/override-hostid.md) of the endpoint where the message was being processed. This header contains three parts:
295
318
296
-
*`$.diagnostics.hostdisplayname`
297
-
*`$.diagnostics.hostid`
298
-
*`$.diagnostics.originating.hostid`
319
+
* `$.diagnostics.hostdisplayname`
320
+
* `$.diagnostics.hostid`
321
+
* `$.diagnostics.originating.hostid`
299
322
300
323
### NServiceBus.TimeSent
301
324
@@ -324,13 +347,13 @@ The NServiceBus version number.
324
347
325
348
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):
Headers added when a message is [audited](/nservicebus/operations/auditing.md)
356
+
Headers added when a message is [audited](/nservicebus/operations/auditing.md).
334
357
335
358
### NServiceBus.ProcessingEnded
336
359
@@ -518,7 +541,6 @@ Part of the control message send back to ServiceControl to signal that a message
518
541
519
542
Contains the [NServiceBus.MessageId](#messaging-interaction-headers-nservicebus-messageid) value of the message that was succesfully processed.
520
543
521
-
Part of the control message send back to
522
-
544
+
Part of the control message send back to ServiceControl to signal that a message that was manually retried in ServicePulse/Control and flag as processed succesful.
523
545
524
-
The presence of any header key that starts with `ServiceControl.` would indicate its a message that is manually retried.
546
+
The presence of any header key that starts with `ServiceControl.` would indicate its a message that is manually retried.
0 commit comments