Table of Contents

Class IntegrationMessageContext

Namespace
Trellis.Mediator
Assembly
Trellis.Mediator.dll

Carries the current inbound integration message's lineage across asynchronous handler work. Applications can also supply an explicit business correlation id without deriving one from a trace.

public static class IntegrationMessageContext
Inheritance
IntegrationMessageContext
Inherited Members

Properties

CorrelationId

The inbound business correlation id, or an explicitly supplied application value.

public static string? CorrelationId { get; }

Property Value

string

CurrentMessageId

The message currently being handled, if any; the direct cause of newly captured domain events.

public static Guid? CurrentMessageId { get; }

Property Value

Guid?

MessageSource

The explicitly supplied producer namespace, if any.

public static string? MessageSource { get; }

Property Value

string

TraceParent

The valid inbound W3C parent when no activity is available.

public static string? TraceParent { get; }

Property Value

string

TraceState

The inbound W3C trace state when no activity is available.

public static string? TraceState { get; }

Property Value

string

Methods

BeginCorrelation(string, string?)

Supplies an application-owned business workflow id for the current async scope. A nonblank inbound CorrelationId takes precedence.

public static IDisposable BeginCorrelation(string correlationId, string? messageSource = null)

Parameters

correlationId string

The opaque business workflow id; must not be blank.

messageSource string

Optional producer namespace to persist with captured events.

Returns

IDisposable

A scope that restores the previous correlation context on disposal.

BeginProcessing(IntegrationEnvelope)

Starts the async context for an inbound integration message.

public static IDisposable BeginProcessing(IntegrationEnvelope envelope)

Parameters

envelope IntegrationEnvelope

The received message and its optional lineage.

Returns

IDisposable

A scope that restores the previous message context on disposal.

TryParseRemoteContext(string?, string?, out ActivityContext)

Parses a W3C remote trace context; returns false for a null, blank, or malformed pair.

public static bool TryParseRemoteContext(string? traceParent, string? traceState, out ActivityContext context)

Parameters

traceParent string
traceState string
context ActivityContext

Returns

bool