Get Your CertGoogle Cloud Associate Cloud EngineerPlayCompete
‹ All Google Cloud Associate Cloud Engineer questions

GCP Associate Cloud Engineer Practice Question 18: Pub/Sub Dead Letter Topic

Google Cloud Associate Cloud Engineer · Test 2 · question 8 of 10

Pub/Submedium

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?

Select one answer
Show answer and explanation

Answer:

  • D. Configure a dead-letter topic on the subscription with a maximum number of delivery attempts

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

Practice Test 2 ›

Study guides for Google Cloud Associate Cloud Engineer