Order-confirmation emails are sent via a Cloud Function; callers receive HTTP 500s and emails are being lost. How do you minimize email loss?
Choose an answer
Tap an option to check your answer.
Correct answer: Publish outgoing email messages to a Pub/Sub topic and update the Cloud Function to consume that topic..
Why this is the answer
Publishing outgoing email messages to a Pub/Sub topic and updating the Cloud Function to consume that topic minimizes email loss. This pattern, known as the "durable execution" or "asynchronous processing" pattern, decouples the email sending from the initial request. If the Cloud Function fails during email sending, the message remains in the Pub/Sub topic and can be retried automatically by Pub/Sub or by another Cloud Function invocation, ensuring eventual delivery. Increasing the Cloud Function timeout only delays the inevitable failure if the email service is unavailable, and still results in lost emails if the timeout is reached. Writing to Memorystore (Redis) introduces another dependency and doesn't inherently guarantee delivery or retry mechanisms for the email sending itself. Having the sender application retry every second on failure creates unnecessary load on the system and doesn't guarantee delivery if the Cloud Function or email service is down for an extended period; it also couples the sender to the email sending logic.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed