,

Before you replay an Azure Service Bus dead letter, check the business deadline

At 10:06, a worker is back online and two messages are sitting in an Azure Service Bus dead-letter queue. Both ask it to confirm an event shuttle seat. One seat hold expired at 10:05. The other runs until 10:15. The same fault put both messages in the queue, but only one can still lead to a booking.

In this fictional example, I would treat the dead-letter queue as a list of work to investigate. Before putting a message back on the live queue, I want to know whether the original action can still be taken and whether it already happened.

Two shuttle tickets: S-041 reads “Action expired, do not send”; a hand lifts S-042, which reads “Still valid, check before replay.”
AI-generated illustration. Both messages reached the same dead-letter queue. Only the seat hold that is still valid can lead to a booking.

Keep the business deadline in the message

Service Bus time to live tells the broker how long a message should remain eligible for delivery on the live queue. For an ordinary send with a per-message TTL, the broker calculates expiry from the enqueue time plus that duration. A fresh send can therefore get a fresh broker expiration. Broker expiry does not interrupt a delivery already under lock. Service Bus does not enforce TTL in the dead-letter queue, and it does not clean out that queue automatically. Finding a message there tells you nothing about whether a seat can still be booked.

Carry the original booking operation ID, the seat hold reference and the absolute business deadline in the command. Store the deadline as a UTC instant; the times here are shortened for readability. The reservation system owns the actual hold. When it confirms the seat, it must check that the hold is still open for this booking, the original deadline has not passed, and the operation has not already been applied. Make those checks part of the operation that confirms the seat. A separate status read can go stale before the write.

Separate the two messages before redrive

Both messages were sent at 10:00 and dead-lettered after a worker configuration fault. At 10:06, check S-041 in the reservation system. If it was never confirmed, record an expired disposition and don’t resend it. If it was already confirmed before the deadline, link the existing result to the dead letter and close the exception without another booking. For S-042, if the hold is still open and the operation is unapplied, allow one redrive with the original 10:15 deadline. Set the replay TTL no longer than the remaining time at send, subject to the queue’s TTL ceiling. At 10:06 that is at most nine minutes. Broker timing and the time of the booking decision can still differ, so at 10:15 or later the reservation system rejects any new confirmation. If the outcome or hold status cannot be verified, leave the item unresolved.

Reusing the original MessageId can hide a valid redrive. In this example the same, non-partitioned queue has duplicate detection enabled with a ten-minute history. At 10:06, Service Bus can report that the send succeeded and discard it as a duplicate. Assign a distinct transport MessageId for the authorized redrive and keep it stable if that same send has to be retried. Keep the original booking operation ID unchanged so the reservation system can recognize an already-applied operation.

Give the operator a disposition to prove

Before completing the dead-letter message, persist the disposition and its evidence: expired, previously applied, or handed to a durable replay process, with the operation ID, deadline and replay reference where applicable. If the original dead letter is delivered again after a replay send or a lost send response, recover the existing replay record and transport ID rather than authorizing a new replay. Keep unresolved items recoverable. Track replay submission and the booking outcome separately.

Test both messages in one rehearsal. Prove S-041 causes no new booking, S-042 confirms at most once before 10:15, and an S-042 replay delayed until 10:15 or later cannot confirm the seat. Lose the dead-letter completion once and verify that redelivery creates no second replay authorization. The recovery is complete when the operator can explain what happened to each booking, not when the dead-letter count reaches zero.

Next step

Need this reviewed in a real system?

Use the article as a starting point, then bring the actual decision, constraints, and failure paths into an architecture review.

Join the discussion

Sign in to comment. Signed-in comments appear immediately.

Join the discussion