Table of Contents

Class TransportOrderingMetadata

Namespace
Excalibur.Dispatch.Transport
Assembly
Excalibur.Dispatch.Transport.Abstractions.dll

Well-known ProviderData keys that carry a transport's native monotonic ordering sequence. They are the one convention a consumer's receive-to-dispatch bridge reads from to stamp the ordering-validation context.

public static class TransportOrderingMetadata
Inheritance
TransportOrderingMetadata
Inherited Members

Remarks

Transports with a native monotonic sequence emit it into ProviderData under one of these keys (a long): Kafka partition offset under KafkaOffsetKey, Azure Service Bus SequenceNumber under AzureServiceBusSequenceKey. The ordering key the sequence is monotonic within is taken from MessageGroupId (falling back to PartitionKey). Centralising these as constants in one contract — rather than magic strings scattered per transport — keeps the convention discoverable and prevents per-transport drift (the fork Amendment 6 forbids). Transports without a native monotonic sequence (e.g. Google Pub/Sub, whose ordering key is a service-enforced string, not a sequence) do not populate these; ordering there is consumer-stamped (opt-in).

Fields

AzureServiceBusSequenceKey

ProviderData key for the Azure Service Bus SequenceNumber (a monotonic long per session/partition).

public const string AzureServiceBusSequenceKey = "azure.sequence_number"

Field Value

string

KafkaOffsetKey

ProviderData key for the Kafka partition offset (a monotonic long per topic-partition).

public const string KafkaOffsetKey = "kafka.offset"

Field Value

string

Methods

TryStampOrdering(TransportReceivedMessage, IMessageContext)

Stamps the ordering-validation sequence onto context from a received message's native transport sequence, if present. Call this from the bridge that turns a received message into a dispatch — the only place holding both — so the extraction cannot drift between transports. Calling it also marks the context as having entered a receive path where ordering is enforced, which is what scopes the ordering-validation middleware to these messages.

public static bool TryStampOrdering(TransportReceivedMessage received, IMessageContext context)

Parameters

received TransportReceivedMessage

The received transport message carrying the native sequence in provider data.

context IMessageContext

The message context to stamp.

Returns

bool

true if a native sequence was found and stamped; otherwise false.

Remarks

Reads the native monotonic sequence from ProviderData under AzureServiceBusSequenceKey or KafkaOffsetKey and the ordering key from MessageGroupId (falling back to PartitionKey), then calls SetOrderingSequence(IMessageContext, long, string?). It is a no-op for transports that carry no native sequence (e.g. Google Pub/Sub) — ordering there is consumer-stamped (opt-in). A missing stamp is not silently safe: if ordering validation is active for the message, the middleware fails closed on an unstamped message, so a forgotten call site surfaces loudly rather than passing unordered.

Exceptions

ArgumentNullException

received or context is null.