The engineering dead letter queue management decision record: why the DLQ ownership model you chose determines your message recovery ceiling and your silent data loss surface

Dead letter queue management is treated as a queue configuration detail — a retention period, a max receive count, a CloudWatch alarm — not as a founding operational decision with data loss consequences that compound over time. The DLQ that the first queue consumer establishes propagates its ownership model, its retention policy, and its replay safety assumptions to every subsequent queue and every incident that surfaces failed messages. Three founding choices — the DLQ routing model, the retention and replay strategy, and the ownership and alerting model — determine how completely failed messages can be recovered, how silently messages can expire, and how much coordination is required when a DLQ fills under incident conditions.

A 20-person B2B SaaS building a subscription billing platform for independent software vendors was processing payment events through a webhook delivery system. When customers connected their Stripe accounts, the platform received webhook events from Stripe and forwarded them to customer-configured endpoint URLs — subscription renewals, payment failures, refund confirmations. The webhook delivery worker used SQS: Stripe events arrived on the main queue, the worker attempted delivery to the customer endpoint, and after three failed delivery attempts within a fifteen-minute window the message was routed to a dead letter queue with the platform's default SQS configuration of four-day retention.

The DLQ had been in production for seven months. In that time it had received exactly eleven messages — nine from customer endpoints that returned 5xx errors during routine maintenance windows and two from endpoint URLs that the customer had changed without updating in the platform settings. The founding engineer who configured the DLQ had checked its depth manually after each anomaly and replayed the messages manually: pulled the message from the queue, re-submitted the webhook to the corrected endpoint, and deleted the DLQ message. It was a low-volume, low-urgency process. No formal alert had been configured because the DLQ had never accumulated more than two messages at once and the founding engineer checked it weekly as part of their infrastructure review.

In the platform's eighth month of operation, Stripe experienced a partial outage that degraded their webhook delivery acknowledgment system. The platform's webhook delivery worker continued receiving events from customers' Stripe accounts, but the customer endpoints returned 503 errors because the downstream confirmation calls those endpoints made back to Stripe were timing out. Over forty-two hours, 847 payment webhook events failed delivery and routed to the DLQ — subscription renewal confirmations, payment capture acknowledgments, and failed-payment retrigger events across 61 customer accounts.

The founding engineer was in the middle of a two-week feature sprint when the Stripe outage ended. The DLQ had accumulated 847 messages on day one and day two of the outage, was now sitting at depth 847, and was receiving no new additions because the outage had cleared. The founder checked the DLQ depth in the weekly infrastructure review — the review happened on day five after the outage start, which was day one after the outage end. The DLQ depth was 847. The plan was to replay after the weekly review: investigate which customer endpoints were still active, batch the replay by customer, and confirm delivery to each. It was a large but manageable cleanup task.

The replay never happened. The sprint ended, the weekly review happened again, there was a production incident unrelated to the DLQ, the team hired two engineers, and the DLQ investigation was deprioritized through a chain of small reprioritization decisions — each individually reasonable, collectively catastrophic. On the morning of day four after the outage, the DLQ had been at depth 847 for four days. The messages were approaching the four-day SQS retention limit. No alert fired. No expiry notification existed. The messages silently expired and were deleted by SQS.

Three weeks after the Stripe outage, the customer success team flagged an anomaly: eleven customers had contacted support with billing state inconsistencies. Subscription renewal events that should have updated customer billing status had not been reflected in the platform. Failed-payment retrigger events had not updated the automatic retry state. The inconsistencies had the same timestamp distribution — all clustered around the Stripe outage window. The engineering team identified the root cause in an afternoon: the 847 expired DLQ messages had contained the state-change events that the platform's billing system had been expecting. The events were gone. The SQS message delivery history did not retain message bodies after expiry. The team had no record of which specific events had been in the queue, which customer endpoints had been targeted, or what state changes had been pending. The remediation required manually auditing billing state against Stripe's event log API for all 61 customer accounts — a twelve-hour reconciliation exercise — and issuing corrected state updates for the eleven accounts that had visible discrepancies. The team could not verify whether the remaining fifty accounts had silent inconsistencies or had been unaffected.

A 41-person e-commerce platform processing orders for direct-to-consumer brands was running an event-driven order pipeline built on RabbitMQ. When a customer placed an order, an order-created event entered the main queue. The order processing consumer executed three steps in sequence: charge the payment method via the payment processor API, create a shipment record in the warehouse management system, and send an order confirmation email to the customer. If any step failed after three retry attempts, the message was routed to a dead letter queue using RabbitMQ's dead-lettering feature.

The DLQ had been designed as a holding area for manual investigation. The founding engineer's mental model was straightforward: messages in the DLQ had failed for a reason that retries alone could not fix — a payment method that was permanently declined, an order with invalid shipping address data, a downstream system timeout that exceeded the retry window. Each DLQ message was an order that needed human review. The team had a weekly DLQ review process: the on-call engineer checked the DLQ, investigated each message, determined whether it was replayable (payment issue resolved, address corrected, downstream system recovered) and replayed or discarded accordingly. It worked for small DLQ volumes of two to ten messages per week.

Seven months into the platform's operation, a database connection pool misconfiguration during a planned infrastructure migration caused the warehouse management system to become unavailable for six hours. During the outage, every order that reached the shipment-creation step failed and routed to the DLQ. The order-created events were well-formed, the payment charges had succeeded, the confirmation emails were pending — but the shipment-creation step could not write to the WMS. By the time the database configuration was corrected and the WMS came back online, the DLQ contained 2,300 messages.

The on-call engineer confirmed that the WMS was healthy, consulted with the founding engineer, and initiated a replay: they re-queued all 2,300 DLQ messages back onto the main order processing queue. The replay was straightforward from an operational perspective — RabbitMQ's management UI had a "Move messages" function — and all 2,300 messages were back in the main queue within twelve minutes. The on-call engineer monitored the consumer throughput, saw the queue drain, and marked the incident as resolved.

The duplicate side effects began appearing in the warehouse management system forty minutes after the replay started. The WMS was generating multiple shipment records for the same order IDs. When the on-call engineer investigated, the root cause was a property of the order consumer that had not been considered during the replay decision: the consumer was idempotent for the payment step (the payment processor SDK supported idempotency keys and the consumer passed the order ID as the idempotency key, so a second charge attempt for the same order returned the original charge result without a second charge) but was not idempotent for the shipment-creation step (the WMS insert used an auto-generated UUID for the shipment record ID rather than a deterministic ID derived from the order ID, so a second insert created a second shipment record for the same order). Of the 2,300 replayed messages, 847 had already completed the payment step successfully before the WMS outage caused the shipment step to fail and route the message to the DLQ. For those 847 messages, the replay produced a no-op payment charge (correctly handled by idempotency) followed by a second shipment-record insert (not handled, duplicate created). The remaining 1,453 messages had failed before the payment step was attempted and replayed cleanly.

The 847 duplicate shipment records required a reconciliation process to identify and delete the duplicates — matching order ID to shipment record, identifying the duplicate by creation timestamp, and deleting the later record. During the reconciliation window, 23 of the 847 orders had already had their duplicate shipment records picked up by the warehouse's fulfillment workflow and dispatched as physical shipment requests to the warehouse floor. Those 23 orders had two open pick lists — one for the original shipment record and one for the duplicate. Twelve of the 23 were caught by warehouse staff who noticed the duplicate SKU pick request before beginning fulfillment. Eleven were not caught. The eleven duplicate shipments were physically assembled and three had been dispatched to the carrier before the engineering team identified which orders were affected and issued stop-shipment requests. The three dispatched shipments could not be recalled; the platform processed customer complaints for the resulting duplicate deliveries over the following two weeks.

A 67-person B2B SaaS providing a data synchronization platform for enterprise HR systems had an event-driven data pipeline built on Apache Kafka. Customer HR data arrived from upstream systems as Avro-serialized events on a set of ingestion topics. The data-sync consumer read from those topics, applied transformation logic, and wrote the results to downstream storage. When deserialization or processing failed after the configured retry count, the consumer wrote the failed message to a dead letter topic — a standard Kafka DLQ implementation using a separate Kafka topic with a dedicated consumer group.

The platform team owned the Kafka infrastructure: broker configuration, topic creation, partition management, consumer lag monitoring, and the DLQ topic configuration. The data-sync engineering team owned the data-sync consumer: the transformation logic, the retry configuration, the downstream write operations, and the business interpretation of what messages in the DLQ meant for data consistency. The ownership split was a consequence of the platform team existing before the data-sync service was built — when the data-sync team needed Kafka, they consumed it as a managed service from the platform team, and the platform team retained ownership of the queue infrastructure as part of their scope.

The platform team had configured a CloudWatch-equivalent alert on DLQ topic depth: alert when the consumer group lag on the DLQ consumer exceeded 1,000 messages. The alert was owned by the platform team's alerting runbook. The data-sync team had no DLQ-specific alerting because they did not own the queue infrastructure — their observability was focused on consumer lag on the main ingestion topics (which indicated whether the data-sync service was processing events in time) and on downstream write error rates (which indicated whether the transformation and storage pipeline was healthy). The DLQ was visible in their monitoring dashboards as a Kafka topic, but it had no dedicated alert in the data-sync team's incident channel.

In the platform's fourteenth month of operation, a schema change was deployed to an upstream HR system integration without a consumer contract check. The upstream team had added two required fields to their Avro schema — employment_type (enum: full_time, part_time, contractor) and cost_center_code (string) — and published the new schema version to the Avro schema registry. The data-sync consumer's schema was pinned to the previous schema version. When messages in the new schema format arrived on the ingestion topic, the data-sync consumer's Avro deserializer encountered an unrecognized schema ID and threw a deserialization exception. The consumer caught the exception, applied the retry policy, exhausted retries, and wrote the message to the DLQ.

The DLQ depth grew at the rate of the upstream system's event production rate: approximately 400 messages per hour during business hours. After three days, the DLQ depth exceeded 1,000 messages and the platform team's alert fired. The platform on-call engineer investigated the alert: the Kafka broker was healthy, the DLQ topic had no replication issues, the consumer group for the DLQ topic was not lagging (messages were being written to the DLQ topic correctly), and the data-sync service's main consumer was processing events from the main ingestion topics without issues. The platform engineer determined that the infrastructure was functioning correctly and the issue was an application-level concern: messages were being processed by the consumer and written to the DLQ as designed. The alert was closed with a note: "Infrastructure healthy. DLQ growth is application behavior. Escalate to data-sync team." The engineer opened a Jira ticket assigned to the data-sync team and marked the alert as resolved.

The data-sync team did not have a Jira integration with their incident alert channel. The ticket appeared in the data-sync team's backlog without triggering any notification to their on-call rotation. The on-call data-sync engineer did not see the ticket for three days — it was filed on a Thursday afternoon, the engineer did backlog grooming on the following Monday morning, and the ticket appeared in the unassigned backlog without a priority label. The DLQ was at depth 11,200 messages when the data-sync engineer opened the Jira ticket on Monday morning and identified the schema mismatch as the root cause.

The Kafka DLQ topic's retention was set to the broker default of seven days. The first messages had been written to the DLQ on the first day of the schema mismatch. By Monday morning — six days after the first failures — the messages from days one and two were approaching retention expiry. The data-sync team began coordinating with the upstream schema owner to agree on a consumer schema migration, but the upstream team required a full review of the new fields' semantics before the data-sync team could implement the schema update. By the time the schema update was deployed and tested and the replay plan was approved — late on Tuesday — 3,400 messages from the first four days of the schema mismatch had expired from the DLQ. The replay of the remaining 7,800 messages succeeded without data loss. The 3,400 expired messages represented four days of HR data for seventeen customer accounts — employee status changes, cost center reassignments, and employment type reclassifications that the downstream HR analytics system had not received. The remediation required requesting a backfill export from the upstream HR system for the affected customers and re-importing the missing records manually.

Structural properties set by the DLQ management decision

Two structural properties are determined by the founding decisions about DLQ routing, retention, replay strategy, ownership, and alerting. Both are invisible during early development when the DLQ accumulates a handful of messages per week that are investigated and replayed manually by the engineer who built the queue. Both become visible under incident conditions: when the DLQ fills rapidly, when the founding engineer is unavailable, when the replay window is tight, and when the investigation requires expertise distributed across multiple teams.

Property 1: Message recovery ceiling. The message recovery ceiling is the highest fidelity that any team can achieve in recovering failed messages — the most complete, most reliable, most side-effect-safe replay — bounded by the properties of the DLQ management model the team has established. Three components. The replay safety component: a consumer that is not idempotent for all message types that can enter the DLQ cannot safely replay without producing duplicate side effects for messages that entered the DLQ after partial processing. The idempotency requirement for DLQ replay is more demanding than the idempotency requirement for general message processing, because DLQ messages are specifically those that failed during processing — which means they are disproportionately represented by the partial-processing case: they reached the DLQ after some but not all state changes were written, and replaying them requires the consumer to detect and handle the already-completed steps without re-executing their side effects. Connect to the queue and messaging decision record: the queue selection decisions that govern at-least-once versus exactly-once delivery guarantees determine the baseline idempotency requirements for the consumer; a consumer built for at-least-once delivery has idempotency requirements in normal operation that are identical to the requirements for DLQ replay — but the partial-processing case is more prevalent in DLQ messages than in normally-delivered messages, because normally-delivered messages that fail mid-processing are retried immediately with exponential backoff (which often resolves transient failures before the DLQ threshold is reached), while DLQ messages are specifically those that exhausted retries and failed persistently. The retention model component: DLQ retention period determines the outer bound on the recovery window — the longest time the team has to investigate, authorize, and execute a replay before messages expire and become irrecoverable. The four-day SQS default and seven-day Kafka default are not safe defaults for all DLQ scenarios; they require an explicit decision about the longest acceptable investigation and replay window, which depends on the message type's business criticality, the team's incident response capacity during off-hours and holiday periods, and the replay authorization process. A DLQ for payment webhook events whose investigation may require coordination with the payment processor support team — whose SLA is measured in business days, not hours — needs a retention period that covers the external coordination window plus the replay execution window. Connect to the event-driven architecture decision record: the event-driven architecture decisions that govern event schema evolution, schema registry usage, and consumer contract testing determine whether schema mismatch is a detectable pre-deployment failure or a runtime DLQ event; teams that implement consumer contract tests (Pact, Avro schema compatibility checks, AsyncAPI validation) catch schema incompatibilities before deployment and prevent the category of DLQ growth caused by schema evolution without consumer coordination; teams without consumer contract testing discover schema incompatibilities when messages begin routing to the DLQ, at which point the investigation and schema migration must happen under the pressure of a growing DLQ and an approaching retention expiry. The replay authorization component: when replay authority is concentrated in a small set of engineers or requires cross-team approval, the recovery window is bounded by those engineers' availability and the cross-team coordination speed. A replay plan that requires sign-off from the DLQ owner, the service owner, and a designated approver for messages containing PII cannot begin until all three are available — which during an off-hours incident, a holiday period, or an incident affecting multiple systems simultaneously may mean the entire retention window elapses before authorization is granted. The replay authorization model must be designed for the team's incident response capacity, not for a scenario where all approvers are reachable within thirty minutes during business hours. Connect to the incident response playbook decision record: the incident response decisions that govern escalation paths, on-call rotations, and incident commander authority apply directly to DLQ replay authorization; a replay authorization model that sits outside the incident response playbook is effectively ungoverned — different engineers apply different authorization standards depending on who is on call and how urgently the replay is needed, which produces the replay-without-idempotency-check incident described in the second failure pattern above.

Property 2: Silent data loss surface. The silent data loss surface is the aggregate amount of message data that can be irrecoverably lost due to DLQ expiry, absent alerting, and discard-on-expiry behavior, with no visible signal to the team that the loss has occurred. Three components. The DLQ ownership model component: when DLQ ownership is split between an infrastructure team that owns the queue configuration and an application team that owns the message semantics, the gap between alert firing and investigation start grows with each organizational boundary the alert must cross. The platform team that receives the DLQ depth alert has the technical context to verify that the queue infrastructure is healthy but lacks the business context to evaluate whether the messages are high-criticality payment events (recovery window: hours) or low-priority audit log entries (recovery window: days or never). The alert disposition becomes "infrastructure healthy, escalate to application team" — which takes the alert off the platform team's incident board without putting it onto the application team's as a paged incident. The escalation ticket arrives in the application team's backlog, not in their incident channel, and the investigation gap is the interval between the platform team closing the alert and the application team discovering the ticket in backlog grooming. Connect to the message broker decision record: the message broker selection decisions that govern whether to use a managed service (SQS, Pub/Sub, EventBridge) or a self-hosted broker (Kafka, RabbitMQ) affect the DLQ ownership model in practice; managed services tend to centralize queue configuration in a single account or project owned by the platform team, while self-hosted brokers may be operated by the application teams themselves; the ownership model that emerges from the broker selection should be explicit in the DLQ ownership ADR rather than inferred from which team first configured the queue. The alerting model component: alert thresholds set as a fixed message count — alert when DLQ depth exceeds 1,000 — without a time-in-queue threshold miss the second dimension of DLQ urgency: how long each message has been waiting. A DLQ at depth 1,000 with messages that arrived one hour ago requires urgent investigation within the remaining retention window. A DLQ at depth 50 with messages that arrived on day three of a four-day retention period requires equally urgent attention — the message count is low but the data loss clock is nearly expired. The time-in-DLQ alert (alert when the oldest message in the DLQ is approaching retention expiry — for example, when the oldest message is older than 75% of the retention period) addresses the second urgency dimension that the depth alert alone cannot capture. Connect to the error handling strategy decision record: the error handling strategy decisions that govern retry policy, exponential backoff, and circuit breaker thresholds determine which failures reach the DLQ and at what rate; a retry policy with aggressive backoff (retry 3 times with 1-second, 4-second, and 16-second delays) routes failures to the DLQ faster than a policy with extended backoff (retry 3 times with 30-second, 300-second, and 3,600-second delays); the DLQ depth growth rate under incident conditions is a function of both the message arrival rate and the retry policy, and the DLQ alerting threshold and retention period should be calibrated against the expected DLQ depth growth rate under the team's most common incident scenarios. The discard policy component: the default behavior when messages expire from a DLQ is silent discard — the message body, the message metadata, the delivery attempt history, and the application-layer context are deleted without any entry in application-layer storage; teams that discover a data loss incident after the DLQ retention has elapsed cannot reconstruct what was lost from the queue itself, and the only recovery path is to identify the gap in downstream state and backfill from upstream sources — which requires that upstream sources have their own retention covering the gap window. A pre-expiry archive step — a Lambda trigger, a Kafka Streams application, or a cron-based archiver that copies messages from the DLQ to cold storage (S3, GCS, a database table) before they expire — converts irrecoverable expiry into recoverable-with-effort expiry; the archived messages can be replayed after the investigation window closes, with higher latency than a DLQ replay but without the data loss. The archive adds operational complexity and storage cost, but for message types where irrecoverable loss carries compliance, financial, or customer-trust consequences, the complexity is justified by the elimination of the data loss risk.

The DLQ management ADR: five sections

Section 1: DLQ routing model. The DLQ routing model defines which failures route to the DLQ, which route to a separate poison-message store, and which are discarded immediately. The ADR must address failure categorization explicitly rather than routing all failures to a single DLQ. Three failure categories require different routing targets. Transient processing failures: the message is well-formed and deserializable, the consumer attempted processing, and processing failed due to a condition that may resolve — a downstream service timeout, a database connection failure, a rate limit exceeded on an external API. These messages should route to the DLQ because the root cause may resolve and the message is a valid candidate for replay after the root cause is addressed. Permanent deserialization failures: the message cannot be deserialized — the schema version is unrecognized, the payload is structurally corrupt, the encoding is incorrect. These messages cannot be replayed by routing them back to the main queue because the consumer that failed to deserialize them will fail to deserialize them again. Routing them to the main DLQ mixes them with replayable messages, increasing DLQ investigation time (each permanent failure must be identified and excluded from the replay plan). These messages should route to a separate poison-message store for schema investigation and schema migration work rather than to the main DLQ. Expired messages: messages with a time-to-live that has elapsed before processing could begin — a cache-invalidation event, a time-sensitive notification, an event whose action is no longer relevant after the TTL window. These messages should be discarded at the consumer rather than routed to the DLQ, because replaying an expired message after the DLQ investigation and replay process (which may take days) produces either a no-op (the state change the message was intended to trigger has already been superseded by a later event) or an incorrect state change (the message represents a past state that is no longer valid). The ADR documents the classification criteria for each message type the consumer processes — which failures are transient and replayable, which are permanent and require schema investigation, and which are expired and should be discarded — so the routing logic in the consumer is derived from an explicit decision rather than from a default catch-all handler. Connect to the queue and messaging decision record: the queue selection decisions that determine whether the consumer uses a visibility timeout (SQS) or a consumer offset (Kafka) affect how the DLQ routing mechanism works; SQS-based DLQs use the maxReceiveCount setting to route messages after a configured number of delivery attempts, while Kafka-based DLQs require the consumer to explicitly write failed messages to the DLQ topic; the routing model must be implemented differently depending on the broker, and the ADR specifies the implementation mechanism for the team's specific broker.

Section 2: DLQ retention and expiry policy. The DLQ retention and expiry policy defines the message retention period for each DLQ type, the pre-expiry archive model for high-criticality message types, and the expiry notification model. The ADR must specify retention periods by message type rather than applying a single default to all DLQs. The retention period calculation for each DLQ type: (1) identify the longest likely investigation duration for the DLQ's message type — this is the time from alert to root cause identification, which depends on whether the investigation is bounded to the team's own systems (hours) or requires coordination with external vendors or other teams (days); (2) add the replay authorization duration — the time from root cause identification to replay plan approval, which depends on the authorization model (see Section 4); (3) add the replay execution duration — the time to execute the replay, monitor for correctness, and confirm completion; (4) add a safety margin of 25–50% to account for incident conditions (key engineers unavailable, concurrent incidents, holiday periods). For payment-critical message types, compliance-sensitive records, or any message type where loss carries financial or regulatory consequences, the calculated retention period should be rounded up to the next meaningful boundary (fourteen days, thirty days) rather than set to the minimum calculated value. The pre-expiry archive model: for message types where the calculated retention period would need to exceed the broker's maximum configurable retention (SQS maximum: fourteen days; Kafka maximum: configurable but practically bounded by storage cost), or for message types where any data loss is unacceptable regardless of retention period, the ADR specifies a pre-expiry archive step: a component that copies messages from the DLQ to durable external storage (S3, GCS, a database table) before they reach their expiry timestamp. The archive trigger is a time-based condition rather than a depth-based condition: archive messages that have been in the DLQ for more than 70% of the configured retention period, so the archive runs with 30% of the retention period remaining — time for the archived message to be identified, extracted, and replayed if investigation is not yet complete. The expiry notification model: the ADR specifies an alert that fires when messages in the DLQ are approaching retention expiry — a time-in-queue alert distinct from the depth alert. The time-in-queue alert fires when the oldest message in the DLQ is older than 75% of the retention period, giving the team 25% of the retention period (one day for a four-day SQS retention, one day eighteen hours for a seven-day Kafka retention) to initiate or complete the replay before data loss begins.

Section 3: Replay strategy model. The replay strategy model defines the idempotency requirements for DLQ replay, the partial-processing detection model, the replay plan requirement, and the replay execution procedure. The ADR must specify the idempotency requirements before the first replay rather than after the first incident. For each consumer that has a DLQ, the ADR documents the answer to three questions. First: is the consumer idempotent for all message types it processes — meaning, if the same message is delivered twice (once in the original delivery attempt and once in a replay), does the consumer produce the same outcome as a single delivery? For consumers that are not idempotent for all message types, the ADR specifies which message types are non-idempotent and what the duplicate side effect would be. Second: for messages that may have entered the DLQ after partial processing — after some but not all processing steps completed — does the consumer detect the partial state and handle the already-completed steps correctly on replay? The ADR specifies the partial-processing detection mechanism for each consumer: typically a database query against the application state store that checks whether the state changes from each processing step have been written before attempting that step. Third: for message types whose side effects are physically irreversible — financial transactions, physical warehouse dispatches, external API calls that cannot be retracted — does the replay plan include a pre-replay verification step that checks whether the irreversible effect was already executed before the replay begins? The replay plan requirement: before any DLQ replay begins, a written replay plan must exist that specifies (1) the root cause of the DLQ accumulation and evidence that it has been resolved or is safe to replay despite, (2) the idempotency verification for the message types in the DLQ (citation of the ADR's idempotency documentation or a specific analysis of the current DLQ contents), (3) the partial-processing check results for the DLQ's contents, (4) the replay execution steps (which tool or script will move messages, in what order, at what rate), (5) the success criteria (how the team will verify that replay completed correctly), and (6) the rollback plan (what the team will do if the replay produces unexpected side effects). The replay plan is reviewed by one engineer who is not the replay executor before the replay begins. The plan review is a checkpoint against rushed replay decisions under incident time pressure, not a bureaucratic delay. Connect to the event-driven architecture decision record: the event-driven architecture decisions that govern event sourcing patterns and event log retention determine whether a replay alternative exists beyond the DLQ itself — specifically, whether the event source (the upstream system that produced the failed events) has a queryable event history that can be replayed directly into the consumer rather than through the DLQ, bypassing the DLQ retention constraint entirely; teams with event-sourced upstream systems may have a broader recovery window than the DLQ retention period suggests.

Section 4: DLQ ownership and investigation model. The DLQ ownership and investigation model defines who owns each DLQ, who receives DLQ depth alerts, who is responsible for investigation, and what constitutes a complete investigation disposition. The ADR must resolve the split-ownership scenario explicitly rather than leaving it to emerge from organizational structure. The two viable ownership models are application-layer ownership and infrastructure-layer ownership; each has conditions under which it is appropriate and conditions under which it fails. Application-layer ownership: the team that owns the consumer that writes to the DLQ also owns the DLQ configuration, the DLQ alerting, and the DLQ investigation. The alert fires into the application team's incident channel and the application team is responsible for the full investigation — both the infrastructure health check (is the queue accessible? are there broker-level errors?) and the message semantics investigation (what failure caused these messages to DLQ? what is the replay risk?). Application-layer ownership is appropriate when the application team has the operational knowledge to manage Kafka or SQS independently, when the DLQ volumes are low enough that per-team configuration overhead is manageable, and when the message types are business-critical enough that the application team must be in the investigation path regardless of infrastructure health. Infrastructure-layer ownership: the platform team owns the DLQ configuration and receives the DLQ depth alert. The platform team's investigation covers infrastructure health only — broker connectivity, topic replication health, consumer group health. The platform team's investigation disposition must include a mandatory escalation step: when infrastructure is confirmed healthy and the DLQ depth continues to grow, the platform team pages (not tickets) the application team's on-call engineer. The paging is not optional and not deferrable to the next business day — a growing DLQ is a retention clock, and the application team's investigation must begin before the retention window closes. The escalation path from infrastructure-layer ownership must be a PagerDuty alert or equivalent routed to the application team's on-call rotation, not a Jira ticket routed to the application team's backlog. The ADR specifies which ownership model applies to each DLQ, the alert routing for each model, and the mandatory escalation procedure for infrastructure-layer ownership. The investigation disposition requirement: a DLQ investigation is complete when the team has documented (1) the root cause of the DLQ accumulation, (2) whether the root cause has been resolved, (3) whether a replay will be executed or the messages will be discarded, and (4) the replay timeline if applicable. A DLQ investigation that concludes with "infrastructure healthy, escalate to application team" without a confirmed escalation receipt from the application team is not complete — it is a transfer of responsibility whose success depends on the escalation channel reliability. The ADR specifies that infrastructure-layer ownership investigations are not closed until the application team's on-call engineer has acknowledged the escalation and confirmed that investigation has begun. Connect to the incident response playbook decision record: the incident response decisions that define severity levels, escalation paths, and incident commander authority should include DLQ management scenarios — specifically, the severity level at which a DLQ growth event becomes a P1 (data loss imminent) versus a P2 (investigation required, no immediate data loss risk), and the incident commander authority for DLQ replay authorization, so the replay decision is made by an identified role rather than by whoever is available during the incident.

Section 5: DLQ alerting model. The DLQ alerting model defines the alert types, thresholds, severity levels, and routing for each DLQ. The ADR must specify at least two alert types for each DLQ: a depth alert and a time-in-queue alert. The depth alert: fires when the DLQ consumer group lag (Kafka) or message count (SQS) exceeds a threshold. The threshold should be calibrated to the DLQ's expected normal-operation depth. For DLQs that should be at depth zero in normal operation (a payment webhook DLQ that only receives messages during customer endpoint outages), the threshold can be low — alert at depth one or depth ten — because any DLQ message is anomalous and warrants investigation. For DLQs that accumulate a small number of messages regularly (a notification delivery DLQ that receives two to five messages per day from customers with temporarily unavailable webhook endpoints), the threshold should be calibrated to distinguish normal accumulation from incident-level accumulation — alert at depth 50 or depth 100 rather than depth one. The alert severity should reflect the message type's business criticality: a payment-critical DLQ depth alert is P2 (investigation required within four hours during business hours, within two hours during off-hours); an analytics event DLQ depth alert may be P3 (investigation required within one business day). The time-in-queue alert: fires when the oldest unacknowledged message in the DLQ has been waiting longer than a specified time threshold. The threshold is set relative to the DLQ's retention period: for a four-day SQS retention, alert when the oldest message is older than three days (75% of retention period — one day remaining to replay); for a seven-day Kafka retention, alert when the oldest message is older than five days (71% of retention period — two days remaining). The time-in-queue alert is a data loss imminent signal — it fires specifically when messages are approaching expiry without having been replayed. Its severity is P1 regardless of the message type's normal DLQ severity, because an approaching-expiry DLQ is a data loss event in progress. The routing for the time-in-queue alert must be to both the DLQ owner and the application team's on-call engineer simultaneously — not through the infrastructure-layer escalation path, because the escalation path adds latency that the remaining retention window may not accommodate. The DLQ alerting runbook: the ADR specifies the runbook steps for each alert type. The depth alert runbook: (1) verify infrastructure health (broker connectivity, topic replication, consumer group registration); (2) identify the root cause of failures using the DLQ message bodies or the consumer error logs; (3) determine whether the root cause has been resolved; (4) if resolved, initiate the replay plan process per Section 3; (5) if not resolved, estimate the resolution timeline and compare it to the retention expiry time; (6) if resolution timeline exceeds retention expiry, initiate the pre-expiry archive process per Section 2 before the archive trigger fires. The time-in-queue alert runbook: (1) verify that pre-expiry archive has captured the approaching-expiry messages; (2) if not archived, execute the archive immediately; (3) escalate replay authorization to incident commander — this is a P1 regardless of root cause resolution status; (4) execute replay under the replay plan or accept archive-based replay at higher latency. Connect to the error handling strategy decision record: the error handling strategy decisions that govern the distinction between retriable and non-retriable errors should map explicitly to the DLQ routing model — errors classified as permanently non-retriable in the error handling strategy should produce poison-message routing rather than DLQ routing in the consumer, so the DLQ remains a replayable message store rather than a mixed-failure bucket; the alignment between the error handling strategy's retriability classification and the DLQ routing model is the mechanism that keeps the DLQ's replay safety assumptions valid across all message types.

FAQ

What should go into a dead letter queue versus being discarded immediately?

The routing decision between DLQ and immediate discard should be made at message type granularity rather than at queue granularity, because different message types in the same queue have different recovery value. A message should route to the DLQ when it has recoverable business value — a future replay would produce the correct state change that the failed delivery was supposed to produce — and when the failure is likely transient or diagnosable. A message should be discarded immediately when: its time-to-live has elapsed (a cache-invalidation event older than the cache TTL has no replay value); when the payload is structurally corrupt and cannot be deserialized by any schema version the consumer supports (retaining it in the DLQ produces an investigation finding of "malformed message" rather than a recovery); when the message is a confirmed duplicate of a successfully-processed earlier message detected by idempotency key. The common failure mode is routing all failures to a single DLQ unconditionally — including deserialization failures and schema incompatibilities — which fills the DLQ with messages that require investigation but cannot be replayed safely, mixing them with messages that are both worth investigating and safe to replay. A poison-message store separate from the DLQ addresses this: schema validation failures and malformed payloads route to the poison-message store for schema investigation; transient failures route to the DLQ for replay after root cause resolution. The routing decision between poison-message store and DLQ is made in the consumer, not in the broker configuration, because only the consumer can distinguish "this message cannot be deserialized at all" from "this message was deserialized correctly but processing failed downstream."

How do you safely replay dead letter queue messages without causing duplicate side effects?

Safe DLQ replay requires verifying three properties of the consumer before initiating any replay: idempotency for fully-unprocessed messages, partial-processing detection for messages that failed mid-consumer, and side-effect isolation for messages whose downstream effects are physically irreversible. Idempotency is the baseline requirement: the consumer must produce the same outcome if the same message is delivered a second time as it would have produced on the first delivery. The idempotency mechanism is usually an idempotency key stored in the application database — the consumer checks the key before processing, writes the key after the first successful processing, and skips on subsequent delivery. Partial-processing detection is required for messages that entered the DLQ after some but not all processing steps completed — specifically, consumers that execute multiple distinct state changes in sequence (charge payment → create shipment → send email). For each DLQ message, the consumer must check which steps have already been completed (by querying the application state store) before beginning the replay, and must skip already-completed steps without re-executing their side effects. Side-effect isolation applies to consumers whose downstream effects are physically irreversible — warehouse dispatch commands, SMS sends, payment captures without idempotency key support. The replay plan for these consumers must include a pre-replay verification query that checks whether the downstream effect was already executed, and must include a rollback or correction plan for any duplicates that do occur. The replay plan — the written list of steps, verifications, and rollback procedures — is a mandatory pre-condition for replay authorization. A replay executed without a plan under incident time pressure is the scenario that produces duplicate warehouse dispatches and double-charged customers.

What DLQ retention period should you configure and how does it affect data loss risk?

DLQ retention period should be set to the maximum time the team reasonably needs to: receive the DLQ depth alert, investigate the root cause, resolve it or confirm safe-to-replay, write and review the replay plan, authorize the replay, and execute it — plus a 25–50% safety margin. For most message types in well-staffed teams, this process takes between four hours and two days during business hours. The AWS SQS default of four days is adequate when investigation and replay can be completed within two working days. It is inadequate when: the root cause requires coordination with an external vendor whose support SLA is measured in business days; when replay authorization requires sign-off from an executive or legal team unavailable during off-hours; when the message type carries compliance-sensitive data requiring a formal incident assessment before replay. For these message types, fourteen or thirty-day retention periods are justified. For message types where any data loss is unacceptable regardless of retention period, configure a pre-expiry archive step — a Lambda trigger, a Kafka consumer, or a cron-based archiver that copies messages approaching expiry (at 70–75% of retention elapsed) to cold external storage (S3, a database table) before they expire. The pre-expiry archive converts irrecoverable expiry into recoverable-with-effort expiry, eliminating the data loss risk at the cost of implementing and maintaining the archiver. The relationship between retention period and data loss risk is non-linear: a retention period that covers 95% of investigation scenarios does not mean 5% of messages are at risk — it means that specific incidents requiring more than the retention period will produce irrecoverable data loss. Set the retention period to cover the worst-case investigation timeline, not the typical case.

How do dead letter queue management decisions connect to AI chat sessions and decision preservation?

Dead letter queue management decisions are made when the first queue consumer is built — the founding engineer configures the DLQ, sets a retention period, and decides whether to alert on DLQ depth — and those decisions are almost always made in AI chat sessions where the team works through the operational model in real time: whether to route all failures to a single DLQ or separate poison-message failures (deserialization errors, schema incompatibilities) from transient failures (downstream service timeouts, database connection failures); whether to set DLQ retention to the AWS default of four days or a longer period calibrated to the message type's investigation timeline; whether to own the DLQ at the infrastructure layer (platform team) or application layer (service team); whether idempotency is required before the first replay or will be assessed per-incident. The reasoning in those sessions — the specific tradeoffs between DLQ simplicity and operational safety, the specific analysis of which message types require pre-expiry archiving, the specific decision about whether the DLQ ownership model should follow queue ownership or message ownership — is the substance of the DLQ management design. It is almost universally made and immediately discarded, leaving every engineer who joins the team afterward to infer intent from the DLQ configuration. The engineer who asks "why is the DLQ retention four days on the payment webhook queue?" will get "that's the AWS default" rather than the founding reasoning — unless the AI chat sessions that made the decision were run through the open-source extractor and the decision record was produced at the time the queue was configured. The decision record allows the engineer inheriting the queue to understand why four-day retention was chosen (at two services and three message types, the investigation process was fast enough that four days covered every scenario — the decision record flags the trigger for extending retention: when an external payment processor is added as a dependency and their support SLA exceeds two business days); why the consumer does not implement idempotency for the shipment-create step (the warehouse management system was an internal service under the team's control, and the team planned to add idempotency when the WMS was replaced with a third-party vendor — the decision record specifies the idempotency design for that migration); and why all DLQ alerts route to the platform team rather than the owning service team (at four services the platform team had context on all four queues; the decision record specifies the threshold at which per-service DLQ ownership is preferable — when any service team has DLQ message types that the platform team cannot evaluate for business impact).