Lesson 15 · Senior NATS practice
Replay, stale events, and idempotency boundaries
How to reason about replay safety, stale-message handling, dedup windows, and the real boundary between transport-level and application-level idempotency.
Your win: explain why replay is useful and dangerous at the same time, and how to talk about stale events, dedup, and idempotency without collapsing them into one idea.
Why replay sounds simpler than it is
Replay sounds like a pure reliability feature: messages are stored, so consumers can recover. That is true. But once a system can replay, it can also repeat, re-order the timing of effects, and wake up business logic that no longer wants the old event.
That is why senior engineers talk about replay safety, not just replay ability. The important question is not “can the bus re-deliver it?” The important question is “if the bus does re-deliver it, is the business outcome still correct?”
Why dedup is only one part of the story
Publish-side dedup via Nats-Msg-Id helps suppress some repeated publishes within the dedup window. That is valuable, but it does not cover every repeated effect. Consumer redelivery, stale payload meaning, and business-level retries can still make the same logical work appear more than once.
So the strongest answer separates the layers. Dedup reduces one class of repeat. Idempotent handling and stale-event guards absorb the rest. If you blur those layers together, your answer sounds neat but not truthful.
Nats-Msg-Id plus app-level idempotency and stale guards like SkipMsgOlderThan work together — not interchangeably.
Replay and dedup together
Use the JetStream model deep dive and the repo map together so the conceptual model stays tied to the real implementation.
Check yourself (from memory)
Q1. What is the strongest senior answer about replay safety?
Sources. JetStream model deep dive; repo NATS map.