Bsft.Correlation.Http
2.1.0
See the version list below for details.
dotnet add package Bsft.Correlation.Http --version 2.1.0
NuGet\Install-Package Bsft.Correlation.Http -Version 2.1.0
<PackageReference Include="Bsft.Correlation.Http" Version="2.1.0" />
<PackageVersion Include="Bsft.Correlation.Http" Version="2.1.0" />
<PackageReference Include="Bsft.Correlation.Http" />
paket add Bsft.Correlation.Http --version 2.1.0
#r "nuget: Bsft.Correlation.Http, 2.1.0"
#:package Bsft.Correlation.Http@2.1.0
#addin nuget:?package=Bsft.Correlation.Http&version=2.1.0
#tool nuget:?package=Bsft.Correlation.Http&version=2.1.0
Bsft.Correlation.Http
The outbound half of the Bsft.Correlation family: an HttpClient delegating handler that attaches the
X-Correlation-Id of the current scope to every request it sends, so the next service continues the same
trace instead of starting its own.
Install
dotnet add package Bsft.Correlation.Http
Requires Bsft.Correlation.Abstractions (pulled transitively) and
Microsoft.Extensions.DependencyInjection.Abstractions for the entry point. No further Bsft packages, and
no ASP.NET Core: this package is deliberately referenceable from a Blazor WebAssembly front end, a console
tool or an integration-test client, and a test pins that closure. A host that also serves requests takes
Bsft.Correlation, which references this package and registers the handler for you.
Register
services.AddBsftCorrelationHttp();
services.AddHttpClient<IBillingServiceClient, BillingServiceClient>()
.AddHttpMessageHandler<CorrelationIdDelegatingHandler>();
Register it per client rather than globally, and only on clients that reach your own services. The handler attaches the header to whatever the client sends, a request following a redirect to another host included. The identifier is not a credential, but it says how a deployment traces itself, and a third party has no business reading that.
Nothing else is required. AddBsftCorrelationHttp() registers the handler and nothing more — it does not
supply an ICorrelationContext, because where the ID comes from differs per host: a server gets it from
AddBsftCorrelation() and its inbound middleware, a client registers its own implementation. The call is
idempotent, so a host that calls AddBsftCorrelation() (which calls this) and this method itself still
ends up with one handler registration.
Configure
| Option | Default | Effect |
|---|---|---|
| — | — | No options type. The header name is fixed at CorrelationDefaults.CorrelationId (X-Correlation-Id) so that the middleware, this handler and every adapter package cannot disagree about it. An outbound request that already carries the header keeps its value. |
Validation: none — there is nothing to configure and therefore nothing that can be misconfigured.
Extend
ICorrelationContext — declared in
Bsft.Correlation.Abstractions, it is what the handler reads
the outgoing ID from and the only seam involved. Bsft.Correlation supplies the request-scoped
implementation for a server; a client that mints or receives its ID some other way implements the interface
itself. CorrelationIdDelegatingHandler is sealed.
Documentation
Topic page: docs/correlation.md. Conventions: docs/package-conventions.md.
| 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 was computed. 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
- Bsft.Correlation.Abstractions (>= 2.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
-
net8.0
- Bsft.Correlation.Abstractions (>= 2.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.19)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Bsft.Correlation.Http:
| Package | Downloads |
|---|---|
|
Bsft.Correlation
BSFT Framework correlation ID tracking for ASP.NET Core |
|
|
Bsft.Resilience
BSFT Framework resilience (retry, circuit breaker, timeout) for HTTP clients, built on Polly. The mediator retry behavior ships in Bsft.Resilience.Mediator. |
GitHub repositories
This package is not used by any popular GitHub repositories.