You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
In any messaging system, some messages inevitably fail processing. A subscriber might crash, the message might contain invalid data, or a downstream service might be permanently unavailable. Without a mechanism to handle these failures, problematic messages are redelivered indefinitely — blocking the subscription and wasting resources. Google Cloud Pub/Sub solves this with dead-letter topics (also called dead-letter queues).
A dead-letter topic is a regular Pub/Sub topic that receives messages that could not be successfully processed by a subscription after a configured number of delivery attempts. When a message exceeds the maximum delivery attempt threshold, Pub/Sub automatically forwards it to the dead-letter topic instead of continuing to redeliver it.
| Problem | Without Dead-Letter Topic | With Dead-Letter Topic |
|---|---|---|
| Poison messages | Block the subscription indefinitely | Moved aside after max attempts |
| Processing errors | Continuous redelivery wastes resources | Failed messages isolated for inspection |
| Subscriber health | Healthy messages delayed behind failures | Subscription processes normally |
| Debugging | Hard to identify which messages failed | Failed messages collected in one place |
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.