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?

  1. Increase the acknowledgement deadline to 10 minutes.
  2. Use immediate redelivery as the subscription retry policy, and configure dead lettering to a different topic with maximum delivery attempts set to 10.
  3. Use exponential backoff as the subscription retry policy, and configure dead lettering to the same source topic with maximum delivery attempts set to 10.
  4. Use exponential backoff as the subscription retry policy, and configure dead lettering to a different topic with maximum delivery attempts set to 10. Source Reference Answer

Community Votes

D
100%

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)

raaad 👍 15 Selected: D
  • 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.
Pime13 👍 1 Selected: D
https://cloud.google.com/pubsub/docs/subscription-overview D. Use exponential backoff as the subscription retry policy, and configure dead lettering to a different topic with maximum delivery attempts set to 10. Exponential Backoff: This retry policy helps to avoid overloading the consumer app by gradually increasing the time between retries, which is more efficient than immediate redelivery. Dead Lettering: Configuring dead lettering to a different topic ensures that messages that cannot be processed after the maximum number of retries (10 in this case) are stored separately. This allows you to handle these messages later without losing any data. Reliability: This configuration ensures that your messaging system is reliable and can handle temporary downtime of the consumer app while maintaining data integrity
JyoGCP 👍 1 Selected: D
Option D
Matt_108 👍 1 Selected: D
Option D - agree with other comments explanation
GCP001 👍 3
D. Use exponential backoff as the subscription retry policy, and configure dead lettering to a different topic with maximum delivery attempts set to 10 Best suitable options for graceful retry and storing failed messages
scaenruy 👍 2 Selected: D
D. Use exponential backoff as the subscription retry policy, and configure dead lettering to a different topic with maximum delivery attempts set to 10.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

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.

Related Analysis

← Back to PDE Study Guide