GCP Associate Cloud Engineer Practice Question 18: Pub/Sub Dead Letter Topic
Google Cloud Associate Cloud Engineer · Test 2 · question 8 of 10
A subscriber application processes messages from a Pub/Sub subscription. A few malformed messages always cause the handler to throw an exception, so they are never acknowledged and are redelivered repeatedly, delaying valid messages and filling the logs.
How should you isolate the failing messages while you keep processing the good ones?
Show answer and explanation
Answer:
A dead-letter topic receives messages that Pub/Sub could not deliver successfully after the configured maximum delivery attempts (5 by default, between 5 and 100). The poison messages then leave the main subscription and can be inspected or replayed later, while valid messages continue to flow.
Option A would make redelivery more frequent, not less. Option B changes the order of delivery but does not stop an unacknowledged message from being redelivered. Option C only controls how long messages are retained, so the failing messages would still be redelivered and block processing.
Reference: Dead-letter topics