A Cloud Run service runs a Python automation that processes Pub/Sub messages. To ensure at-least-once processing without creating duplicate side effects, which approach best matches a robust idempotency design?

Answer

Store a deterministic idempotency key (e.g., messageId or a hash of payload) in a datastore and use conditional writes before applying changes

Explanation

Pub/Sub can redeliver, so idempotency requires duplicate detection with atomic/conditional writes. Deterministic keys make retries safe and preserve at-least-once semantics.

Last reviewed: October 2026

Reviewed by FirstInTest Editorial Team

Report an error
QuestionBack to list