How would you test ordering, replay and dead-letter behavior in a messaging system?
Answer
Define where ordering is promised—globally, per key or not at all—and publish interleaved messages across partitions and consumers. Inject poison messages, timeouts and crashes around acknowledgment; verify retry limits, backoff, dead-letter metadata and that unrelated messages continue. Replay a bounded range and confirm idempotent outcomes, preserved provenance and observable lag without silently skipping data.
Strong answer includes
- states the actual ordering scope
- injects failures around processing and acknowledgment
- verifies replay safety, dead-letter evidence and progress
Practical example
A test publishes a malformed poison message into the middle of a stream of otherwise valid orders; a correct consumer routes just that one message to the dead-letter queue with the original headers intact and keeps processing the orders after it, while a broken consumer either crashes the whole partition or silently drops every message that follows.