NetEvolve.Pulse.HttpCorrelation
0.17.3
Prefix Reserved
dotnet add package NetEvolve.Pulse.HttpCorrelation --version 0.17.3
NuGet\Install-Package NetEvolve.Pulse.HttpCorrelation -Version 0.17.3
<PackageReference Include="NetEvolve.Pulse.HttpCorrelation" Version="0.17.3" />
<PackageVersion Include="NetEvolve.Pulse.HttpCorrelation" Version="0.17.3" />
<PackageReference Include="NetEvolve.Pulse.HttpCorrelation" />
paket add NetEvolve.Pulse.HttpCorrelation --version 0.17.3
#r "nuget: NetEvolve.Pulse.HttpCorrelation, 0.17.3"
#:package NetEvolve.Pulse.HttpCorrelation@0.17.3
#addin nuget:?package=NetEvolve.Pulse.HttpCorrelation&version=0.17.3
#tool nuget:?package=NetEvolve.Pulse.HttpCorrelation&version=0.17.3
NetEvolve.Pulse.HttpCorrelation
NetEvolve.Pulse.HttpCorrelation automatically propagates the HTTP correlation ID from IHttpCorrelationAccessor into every IRequest<TResponse> and IEvent dispatched through the Pulse mediator — eliminating the need to manually copy the correlation ID at every call site.
Features
- Zero-effort correlation: Automatically enriches every mediator request and event with the current HTTP correlation ID.
- Non-destructive: Never overwrites a
CorrelationIdthat has already been set by the caller. - Optional dependency: When
IHttpCorrelationAccessoris not registered (e.g. background services), both interceptors pass through silently without error. - Idempotent registration: Calling
AddHttpCorrelationEnrichment()multiple times registers each interceptor only once. - Scoped lifetime: Interceptors are scoped so they resolve the current request's
IHttpCorrelationAccessorinstance on every invocation — no captive dependency issues.
Installation
NuGet Package Manager
Install-Package NetEvolve.Pulse.HttpCorrelation
.NET CLI
dotnet add package NetEvolve.Pulse.HttpCorrelation
PackageReference
<PackageReference Include="NetEvolve.Pulse.HttpCorrelation" Version="x.x.x" />
Quick Start
Register both interceptors in one call at startup:
services.AddPulse(c => c.AddHttpCorrelationEnrichment());
Prerequisites: You must also register
IHttpCorrelationAccessorusing your chosenNetEvolve.Http.Correlation.*middleware package (e.g.NetEvolve.Http.Correlation.AspNetCore).
Usage
ASP.NET Core Example
using NetEvolve.Http.Correlation.AspNetCore;
using NetEvolve.Pulse;
var builder = WebApplication.CreateBuilder(args);
// 1. Register the HTTP correlation middleware (provides IHttpCorrelationAccessor)
builder.Services.AddHttpCorrelation();
// 2. Register the Pulse mediator with HTTP correlation enrichment
builder.Services.AddPulse(c => c.AddHttpCorrelationEnrichment());
var app = builder.Build();
// 3. Add the correlation middleware to the pipeline
app.UseHttpCorrelation();
app.Run();
From this point on, any IRequest<TResponse> or IEvent whose CorrelationId is null or empty will automatically receive the value from the X-Correlation-ID header of the current HTTP request.
Propagation Logic
The interceptors apply the following rule before invoking the next handler:
if request.CorrelationId is null or empty
→ resolve IHttpCorrelationAccessor
→ if accessor.CorrelationId is non-empty
→ request.CorrelationId = accessor.CorrelationId
The accessor is resolved lazily — only when the message actually needs a correlation ID. Existing non-empty CorrelationId values are never overwritten, so callers can explicitly set a custom correlation ID that will be respected throughout the pipeline.
Background Services
When dispatching mediator messages outside of an HTTP context (e.g. from a hosted service or message consumer), IHttpCorrelationAccessor may not be registered. In that case both interceptors pass through without any modification or error:
// No IHttpCorrelationAccessor registered — interceptors are no-ops
services.AddPulse(c => c.AddHttpCorrelationEnrichment());
Requirements
- .NET 8.0, .NET 9.0, or .NET 10.0
Microsoft.Extensions.DependencyInjection.AbstractionsforIServiceProviderextensionsNetEvolve.Http.Correlation.AbstractionsforIHttpCorrelationAccessor- A compatible
NetEvolve.Http.Correlation.*implementation package to registerIHttpCorrelationAccessor
Contributing
Contributions are welcome! Please read the Contributing Guidelines before submitting a pull request.
Support
- Issues: Report bugs or request features on GitHub Issues
- Documentation: Read the full documentation at https://github.com/dailydevops/pulse
License
This project is licensed under the MIT License — see the LICENSE file for details.
Related Packages
- NetEvolve.Pulse - Core CQRS mediator
- NetEvolve.Pulse.Polly - Polly v8 resilience interceptors
- NetEvolve.Pulse.Extensibility - Extensibility contracts
- NetEvolve.Pulse.EntityFramework - Entity Framework Core outbox persistence
- NetEvolve.Pulse.SqlServer - SQL Server ADO.NET outbox persistence
- NetEvolve.Http.Correlation.AspNetCore - ASP.NET Core middleware that provides
IHttpCorrelationAccessor
Made with ❤️ by the NetEvolve Team
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- NetEvolve.Http.Correlation.Abstractions (>= 3.1.0)
- NetEvolve.Pulse.Extensibility (>= 0.17.3)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- NetEvolve.Http.Correlation.Abstractions (>= 3.1.0)
- NetEvolve.Pulse.Extensibility (>= 0.17.3)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- NetEvolve.Http.Correlation.Abstractions (>= 3.1.0)
- NetEvolve.Pulse.Extensibility (>= 0.17.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.17.3 | 190 | 3/28/2026 |