How to configure Pub/Sub retries and dead-lettering?
You are designing a messaging system by using Pub/Sub to process clickstream data with an event-driven consumer app that relies on a push subscription. You need to configure the messaging system that is reliable enough to handle temporary downtime of the consumer app. You also need the messaging system to store the input messages that cannot be consumed by the subscriber. The system needs to retry failed messages gradually, avoiding overloading the consumer app, and store the failed messages after a maximum of 10 retries in a topic. How should you configure the Pub/Sub subscription?
Community Votes
100% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests the selection of exponential backoff for gradual retries versus immediate redelivery, and the necessity of sending dead-lettered messages to a different topic to avoid infinite loops.
To ensure reliable message processing and prevent consumer overload, the correct configuration involves using exponential backoff for retries and dead-lettering to a separate topic after 10 attempts. The community confirms this approach balances retry logic with failure handling.
Choosing Option C is a frequent error because, while it correctly selects exponential backoff, it incorrectly specifies dead-lettering to the same source topic, which causes message loops.
Community Discussion (6 comments)
- Exponential Backoff: This retry policy gradually increases the delay between retries, which helps to avoid overloading the consumer app. - Dead Lettering to a Different Topic: Configuring dead lettering sends messages that couldn't be processed after the specified number of delivery attempts (10 in this case) to a separate topic. This allows for handling of failed messages without interrupting the regular flow of new messages. - Maximum Delivery Attempts Set to 10: This setting ensures that the system retries each message up to 10 times before considering it a failure and moving it to the dead letter topic.
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option D is correct because it implements exponential backoff, which gradually increases the wait time between retries, effectively preventing the consumer app from being overloaded during outages. Furthermore, it configures dead-lettering to a different topic, ensuring messages that fail after 10 delivery attempts are stored separately for inspection without disrupting the main pipeline.Why the Other Options Are Wrong
Option A is incorrect because adjusting the acknowledgement deadline does not inherently handle retry logic or store failed messages. Option B is incorrect because immediate redelivery violates the requirement to retry gradually and avoid overloading the consumer. Option C is incorrect because dead-lettering to the same source topic creates an infinite loop where failed messages are re-processed immediately as new messages.Community Comment Notes
Community members consistently voted for Option D, emphasizing that exponential backoff is the standard for graceful retries and that dead-lettering must target a distinct topic. Comments highlight that sending failed messages to a different topic allows for isolation of errors, whereas sending them back to the source is a critical architectural flaw.Official Reference
Exam Strategy
When encountering retry requirements in Pub/Sub questions, look for keywords like 'gradually' or 'avoid overloading' to identify exponential backoff. Always remember that dead-letter topics must be separate from the subscription's source topic to prevent infinite processing loops.