Table of Contents

Class OutboundIntegrationMessage

Namespace
Trellis.Mediator
Assembly
Trellis.Mediator.dll

The publish-side counterpart of IntegrationEnvelope: the integration event to publish together with the stable MessageId a transport must carry verbatim onto the wire.

public sealed record OutboundIntegrationMessage : IEquatable<OutboundIntegrationMessage>
Inheritance
OutboundIntegrationMessage
Implements
Inherited Members
Extension Methods

Remarks

Why the id travels with the event. Consumer-side deduplication keys on (ConsumerId, MessageId), and MessageId is specified as the producer's outbox message id carried verbatim by the transport. Outbox relay delivery is at-least-once, so the same row can be published more than once — a crash between publishing and the relay's bookkeeping save re-delivers it. A transport that minted a fresh id per publish attempt would put a different MessageId on each copy, the consumer's dedup would miss, and handlers would run twice. Passing the row's own id makes redeliveries indistinguishable to the consumer, which is exactly what the inbox needs.

This collapses redeliveries of a single outbox row. It does not collapse the other duplicate the outbox can produce: a retried domain row re-runs its translator and stages a genuinely new integration row with its own id. Consumers still dedupe that on business identity.

Optional lineage and W3C trace context are copied from the persisted outbox row, not from the relay's ambient activity, so retries and redeliveries keep the same identity and parent context.

Constructors

OutboundIntegrationMessage(Guid, IIntegrationEvent)

The publish-side counterpart of IntegrationEnvelope: the integration event to publish together with the stable MessageId a transport must carry verbatim onto the wire.

public OutboundIntegrationMessage(Guid MessageId, IIntegrationEvent Event)

Parameters

MessageId Guid

The stable, unique message identity — the producer's outbox row id (a UUIDv7). Every redelivery of the same row carries this same value. Must not be Empty: an empty id is not a missing value a transport can work around, because every message stamped with it collapses to the same (ConsumerId, MessageId) inbox key and the consumer would discard all but the first as duplicates.

Event IIntegrationEvent

The integration event to publish.

Remarks

Why the id travels with the event. Consumer-side deduplication keys on (ConsumerId, MessageId), and MessageId is specified as the producer's outbox message id carried verbatim by the transport. Outbox relay delivery is at-least-once, so the same row can be published more than once — a crash between publishing and the relay's bookkeeping save re-delivers it. A transport that minted a fresh id per publish attempt would put a different MessageId on each copy, the consumer's dedup would miss, and handlers would run twice. Passing the row's own id makes redeliveries indistinguishable to the consumer, which is exactly what the inbox needs.

This collapses redeliveries of a single outbox row. It does not collapse the other duplicate the outbox can produce: a retried domain row re-runs its translator and stages a genuinely new integration row with its own id. Consumers still dedupe that on business identity.

Optional lineage and W3C trace context are copied from the persisted outbox row, not from the relay's ambient activity, so retries and redeliveries keep the same identity and parent context.

Properties

CausationId

The source domain outbox row's id, when this event was translated.

public Guid? CausationId { get; init; }

Property Value

Guid?

CorrelationId

The optional, application-owned business workflow identifier.

public string? CorrelationId { get; init; }

Property Value

string

Event

Gets the integration event to publish.

public IIntegrationEvent Event { get; init; }

Property Value

IIntegrationEvent

Exceptions

ArgumentNullException

The value is null.

MessageId

Gets the stable, unique message identity — the producer's outbox row id (a UUIDv7).

public Guid MessageId { get; init; }

Property Value

Guid

Exceptions

ArgumentException

The value is Empty.

MessageSource

The optional producer namespace.

public string? MessageSource { get; init; }

Property Value

string

TraceParent

The persisted W3C traceparent value, when available.

public string? TraceParent { get; init; }

Property Value

string

TraceState

The persisted W3C tracestate value, when available.

public string? TraceState { get; init; }

Property Value

string