You are building a Python Cloud Function that triggers on a Pub/Sub message containing a job ID. To guarantee at-least-once delivery processing without duplicate side effects, what is the best approach?

Answer

Use the job ID as an idempotency key stored in a durable datastore (e.g., BigQuery/Datastore/Firestore) before applying side effects

Explanation

At-least-once means duplicates can occur; durable idempotency storage ensures the same job ID does not reapply side effects. Globals are not durable across instances or restarts.

Last reviewed: October 2026

Reviewed by FirstInTest Editorial Team

Report an error
QuestionBack to list