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: docs/guides/correlation-causation-guide.md
+21-23Lines changed: 21 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,12 +34,11 @@ The Book Store API implements **causation** and **correlation** IDs for distribu
34
34
35
35
### Response Headers
36
36
37
-
`MartenMetadataMiddleware` automatically echoes the correlation ID in every response.`EventMetadataService.SetResponseHeaders()` additionally emits `X-Event-ID` when an endpoint explicitly creates event metadata.
37
+
`MartenMetadataMiddleware` automatically echoes the correlation ID in every response.
38
38
39
39
| Header | Description | Example |
40
40
|--------|-------------|---------|
41
41
|`X-Correlation-ID`| Echo of the request correlation ID (or generated) |`019541ab-1234-7000-a000-000000000001`|
42
-
|`X-Event-ID`| ID of the event appended during this request |`019541ab-9abc-7000-c000-000000000003`|
43
42
44
43
## Event Metadata Structure
45
44
@@ -86,7 +85,6 @@ curl -X POST http://localhost:5000/api/admin/books \
- Not a middleware — a scoped service used by endpoint handlers.
291
+
- Not a middleware — a scoped service available for endpoint/handler use.
306
292
-`CreateMetadata()` builds an `EventMetadata` record containing a fresh `Guid.CreateVersion7()` event ID plus `CorrelationId`, `CausationId`, and `UserId` read from `IHttpContextAccessor`.
307
-
-`SetResponseHeaders()`writes `X-Correlation-ID` and `X-Event-ID`to the response — endpoints call this explicitly after appending events.
293
+
-`SetResponseHeaders()`exists, but endpoints do not currently call it; `X-Event-ID`is not emitted in API responses.
308
294
309
295
### Blazor Frontend Implementation
310
296
@@ -322,7 +308,7 @@ The Blazor frontend automatically manages and propagates these IDs using a dedic
322
308
- Injects `X-Correlation-ID` and `X-Causation-ID` headers from `ClientContextService` on every outgoing API request.
323
309
- Attaches the JWT Bearer token.
324
310
- Forwards the original browser's `User-Agent` and `X-Forwarded-For` IP from `IHttpContextAccessor`.
325
-
- After each response: reads `X-Event-ID`from the response headers and calls`ClientContextService.UpdateCausationId(eventId)`, automatically advancing the causation chain.
311
+
- After each response: attempts to read `X-Event-ID` and update`ClientContextService` when present.
0 commit comments