Handle it by isolating the poison message so it never blocks the stream.
1. Retry with limits + backoffāØTransient failures get a small number of retries (e.g. 3ā5) with exponential backoff. Persistent failures are treated as poison.
2. Dead-letter queue (DLQ)āØAfter retries are exhausted, route the bad event (plus error context, stack trace, and original payload) to a DLQ topic/queue. Commit the offset and continue processing the rest of the stream. This keeps the main consumer moving at 1M events/min.
3. Poison-message detectionāØTrack consecutive failures per partition or key. If the same event (or events matching a pattern) keeps crashing the consumer, automatically divert it to the DLQ rather than letting it thrash.
4. Safe recovery
⢠Monitor DLQ depth and alert.
⢠Inspect the bad events offline (schema issues, nulls, unexpected types, etc.).
⢠Fix the root cause (code, schema evolution, validation).
⢠Replay from the DLQ in a controlled way (separate consumer, validation gate, or rate-limited) so you donāt re-introduce the crash.
⢠Optionally add upstream schema validation or a lightweight filter so obvious bad events never reach the main consumer.
Result: the pipeline stays available, valid events keep flowing, and bad data is quarantined for later analysis instead of taking everything down.