Table of Contents

Dead-letter queue

This page documents Orleans.Lattice.Schema 10.5.0, in the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at dead-letter-queue.md, and llms.txt lists every page.

The dead-letter queue (DLQ) is where a tree's schema machinery parks a rejected system-origin item instead of applying it to the governed tree. After the append succeeds, the interceptor returns a dead-letter decision rather than a schema-violation exception, so the offending value need not be repaired before other ingest can proceed. This is not an unconditional liveness guarantee: the store write is awaited, and storage failure or cancellation propagates to the intercepted write. Diversion does not acknowledge an item that could not be recorded. An operator inspects the recorded item out of band. Only ingest that reaches a tree's write operations can land here, which in practice is any replicated entry - a plain last-writer-wins write (whether a single entry, a merged batch, an anti-entropy repair re-ship or a write routed to a bootstrap copy), a typed-CRDT entry, an entry of a replicated atomic batch, or a row a receiver bootstrap drains from a peer's export - and is filed under the logical tree's id. A backup restore writes below the strict check and never produces an entry (see strict-mode ingest). With anti-entropy auto-remediation on (off by default), a diverted plain row stays a divergence, but repair re-ships it only after the peer's leaf digest for its range changes, and each re-delivery of the same source write rewrites its one record rather than filing another (see the source identity below; #5714). A dead-lettered entry of a replicated atomic batch is left out of that batch, and the receiver commits the batch's other entries. The entry's dead-letter record is an ordinary committed write to the sys-schema-dlq tree in its own right: it is not part of the batch's transaction, so it is durable and visible as soon as the diversion is reported, whether the entry's prepare arrived before or after the batch's commit decision, and whatever the batch's own terminal later does. It is stamped by the receiver's clock, not with the entry's source origin, clock or delta.

The receiver judges each entry by its own region's policy and catalog, not the verdict of the region that wrote it, so a value one region accepted can be dead-lettered in another (see runtime registration). The SchemaCrossRegion TLA+ module checks this; see its refinement note.

What lands in the DLQ

An entry is created only in strict-ingest mode. Each entry records the offending key, a bounded preview of the value (capped by the writing add-on's DeadLetterPreviewMaxBytes option), the full byte length, a human-readable reason, the source, and a UTC timestamp. For an item that arrived already carrying a version envelope, the preview and the byte length cover the stored, enveloped bytes, while the reason describes the body it was judged by (see composition with versioning).

A replicated plain last-writer-wins row - a single entry, a merged batch, a repair re-ship, or a row a bootstrap drains - also records its source identity: the originating region's cluster id (OriginClusterId) and the source write's hybrid logical clock (SourceHlc). When both are set, the record's timestamp is the source write's wall-clock time and the default store keys the record by that identity, so every re-delivery of the same source write overwrites one record instead of filing another. Any other diversion - a typed-CRDT entry or an entry of a replicated atomic batch - leaves both fields null, is stamped by the receiver's clock, and gets a unique record per diversion.

A refused item is diverted once: a refused full-state CRDT row (the bootstrap form) is not retried as a version conflict, and an entry of a replicated atomic batch whose apply a bootstrap hold mirrors onto a second copy is recorded once, and that one record is committed independently of the batch. A bootstrap import is judged per copy it stages into. A transient retry of the drain into the same copy records a refused row once. If the import's copy is discarded and the bootstrap is started again into a new copy, every row is applied and judged again in the new copy. A refused plain row carries its source identity, so the new copy rewrites its one record; a refused typed-CRDT row carries none, so it gains one more record per discarded copy, and an operator reading the queue may see the same key and reason more than once. The source is one of:

LatticeSchemaDeadLetterSource Meaning
Replication A system-origin ingested item other than a bulk-load item - in practice a replicated plain last-writer-wins write, a replicated typed-CRDT delta or full-state row, or an entry of a replicated atomic batch - failed strict validation.
Restore A bulk-load item (BulkLoadAsync or BulkAppendChunkAsync) arriving as system-origin ingest failed enforcement's strict validation. No shipped ingest path issues one - a backup restore writes below the strict check - so in practice this source does not occur.
LocalRejected Reserved for a rejected local write retained for inspection. Not produced by the current release, which fails local writes closed (see below).

The Restore source is assigned only by enforcement. An item the versioning stage dead-letters (a version that is newer than the target or cannot be upcast) is always recorded with the Replication source, even when it arrived through a bulk load.

A direct local write that violates a policy fails closed: it is rejected to the caller with LatticeSchemaViolationException and nothing is made durable. The rejected value is not mirrored to the DLQ. Only system-origin ingest that reaches a tree's write operations lands entries here, so in the current release every entry carries the Replication or Restore source. LocalRejected is a reserved source for a future opt-in that would also retain the rejected local value; no code path produces it today.

Reading it from the schema admin

The in-process ILatticeSchemaAdmin exposes the queue directly. It performs no authorization of its own; the schema API facade authorizes remote reads of the queue on Read authority (see Capability gate):

Lists and counts include only the exact requested tree, even when tree names or item keys contain the storage delimiter U+001F. The store verifies each row's complete key against its recorded timestamp and item key; a shared key prefix alone is not evidence that the row belongs to the authorized tree. Counts use the same filtered scan as lists, including for previously persisted rows.

using Orleans.Lattice.Schema;

var admin = client.ServiceProvider.GetRequiredService<ILatticeSchemaAdmin>();

int count = await admin.CountDeadLettersAsync("orders", cancellationToken);

await foreach (var entry in admin.ListDeadLettersAsync("orders", cancellationToken))
{
    Console.WriteLine($"{entry.TimestampUtc:o} {entry.Source} '{entry.Key}': {entry.Reason}");
}

Reading it through the State API

The read-only cluster State API surfaces the same queue for dashboards and the Explorer, paginated and subject to the API's tree read-visibility gate. Its read-only query surface (ILatticeStateQuery) exposes GetDeadLetterCountAsync and a paginated ListDeadLettersAsync that takes a DeadLetterQueueRequest (TreeId, PageSize, PageToken) and returns a DeadLetterQueuePage - a list of DeadLetterEntryRecord plus a NextPageToken for the next page. Each record carries the offending Key, a bounded ValuePreview (with PreviewTruncated and the full ValueByteLength), the Reason, the Source (a DeadLetterSourceKind), and TimestampUtc.

The DLQ store (ILatticeSchemaDeadLetterStore, registered by either schema add-on) is an optional dependency: if the schema package is not installed, the count is zero and the page is empty rather than an error, as they also are for a caller that may not read the tree. The bundled Explorer app renders this page as a per-tree DLQ panel, and the gRPC State API binding projects the same records over the wire.

Scope

The current release surfaces the queue read-only: list, count, and inspect. Replay / requeue of a dead-lettered item and retention / cap policies are documented follow-ups, not part of this release.

See also