Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
A payment processing team deploys a Cloud Run service triggered by Eventarc Standard to update an order database and call an external payment gateway API. During rollout, the team observes two reliability issues:
500 errors, retrying for 24 hours before messages are silently discarded.Which strategy should the team implement to ensure consistent processing, recover from transient errors, and preserve persistent failures?
source and id as an idempotency key and tracking processed events in a database transaction, and configure a dead-letter topic with a maximum delivery attempts limit on the Eventarc trigger's underlying Pub/Sub subscription.This approach pairs idempotent service logic in Cloud Run with subscription-level failure handling on the Pub/Sub transport layer that backs Eventarc Standard. Because Eventarc Standard guarantees at-least-once delivery, any transient failure or network disruption can cause the same event to be delivered multiple times.
source and id uniquely identifies each event. Passing this unique identifier as an idempotency key to the payment gateway API—and recording the processed event ID inside a database transaction before mutating order state—ensures that retried or duplicate deliveries produce the exact same outcome without charging the customer twice.5xx errors.eventarc-REGION-) and attaching a dead-letter topic with a maximum delivery attempts limit ensures that malformed payloads or unrecoverable errors stop retrying after a bounded threshold and are forwarded to a separate topic for inspection and replay instead of expiring silently after the 24-hour retention window.Unlike disabling retries, switching to pull-only features, or dropping aged events in application code, combining transactional idempotency with a Pub/Sub subscription dead-letter topic resolves both duplicate side effects and silent message expiration while preserving automatic recovery for transient failures.
200 OK response immediately upon receiving an event, and execute an internal retry loop with exponential backoff inside the handler without an idempotency key.Returning an HTTP 200 OK status immediately tells Eventarc and Pub/Sub that the message has been acknowledged before any database update or payment gateway request executes. The handler then attempts to perform its own internal in-process retry loop.
2xx status code after business logic completes (or after explicitly persisting or forwarding a fatal failure).200 OK, persistent malformed-payload failures are never tracked or routed to a dead-letter topic.Immediate acknowledgment is only safe when the handler atomically persists the event into durable storage or another managed queue (such as Cloud Tasks or Spanner queues) before returning 200 OK, and even then, downstream API calls must still use idempotency keys.
Rely on Eventarc's built-in Pub/Sub retry mechanism with exponential backoff rather than uncoordinated in-memory retry loops, and always process and verify state transitions before returning an HTTP 200 acknowledgment.
Creating an Eventarc trigger from the Cloud Run page in the Google Cloud console sets the trigger to a single delivery attempt with no retries by default. Combining that with an event-age check in Cloud Run drops any event whose timestamp is older than 10 seconds.
gcloud CLI, Terraform, or the Eventarc console page enable retries by default.This configuration would be appropriate in a development or testing environment where minimizing compute cost and avoiding runaway retry loops is more important than guaranteeing delivery, or for ephemeral, non-critical events (like real-time cache invalidation) that become irrelevant after 10 seconds.
In production payment systems, retries should remain enabled to survive transient downstream outages, paired with idempotency and a dead-letter topic to safely capture unprocessable messages.
This option attempts to eliminate duplicate charges by enabling Pub/Sub exactly-once delivery and tries to capture failed messages by attaching a dead-letter topic directly to the Pub/Sub topic created by Eventarc.
2xx vs. 4xx/5xx) signal acknowledgment or retry.Enabling exactly-once delivery would be relevant if the architecture used a pull subscriber (such as a Compute Engine worker or GKE service using the Pub/Sub client library) that could tolerate higher publish-to-subscribe latency and needed Pub/Sub to minimize duplicate deliveries before reaching the consumer.
Always inspect the auto-generated subscription associated with an Eventarc trigger (using gcloud eventarc triggers describe) and apply dead-letter policies directly to that subscription, while keeping Cloud Run handlers idempotent.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated