Table of Contents

Class CorrelationIdHandler

Namespace
Quilt4Net.Toolkit.Framework
Assembly
Quilt4Net.Toolkit.dll

A DelegatingHandler that forwards the ambient correlation id on outbound HTTP calls. Attach it to any HttpClient (via IHttpClientBuilder.AddQuilt4NetCorrelationId()) whose target should receive the same X-Correlation-ID as the current request — letting one id span the consuming app, the services it calls, and Quilt4Net.Server.

public sealed class CorrelationIdHandler : DelegatingHandler, IDisposable
Inheritance
CorrelationIdHandler
Implements
Inherited Members

Remarks

No-op when there is no ambient id (Current is null/empty) or when the request already carries the header — so an explicitly-set id is never overwritten.

Constructors

CorrelationIdHandler(ICorrelationIdAccessor)

public CorrelationIdHandler(ICorrelationIdAccessor accessor)

Parameters

accessor ICorrelationIdAccessor

Methods

SendAsync(HttpRequestMessage, CancellationToken)

Sends an HTTP request to the inner handler to send to the server as an asynchronous operation.

protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)

Parameters

request HttpRequestMessage

The HTTP request message to send to the server.

cancellationToken CancellationToken

A cancellation token to cancel operation.

Returns

Task<HttpResponseMessage>

The task object representing the asynchronous operation.

Exceptions

ArgumentNullException

The request was null.