Question 788 of 890
hardMultiple ChoiceObjective-mapped
Exactly-Once Processing with Pub/Sub and Dataflow
A Dataflow pipeline reads from Cloud Pub/Sub and writes to Cloud Storage. The pipeline needs to guarantee exactly-once processing despite worker failures. Which configuration ensures exactly-once semantics?
Quick Answer
The correct answer is to enable exactly-once delivery on the Pub/Sub subscription and use an idempotent sink. This configuration works because Pub/Sub’s `enableExactlyOnceDelivery` flag guarantees that each message is delivered to the subscriber only once, eliminating duplicate deliveries at the source. Pairing this with an idempotent sink—such as Cloud Storage with unique filenames or deduplication logic—ensures that even if a worker fails and Dataflow retries, the output remains free of duplicates, achieving end-to-end exactly-once semantics. On the Google Professional Data Engineer exam, this question tests your understanding of how to combine source-side guarantees with sink-side idempotency, a common trap being that enabling exactly-once on the subscription alone is insufficient without an idempotent sink. Remember the mnemonic: “Source once, sink idempotent—no duplicates, no torment.”
⚠ Common exam trap
Google Cloud often tests the misconception that a single transform (like Reshuffle) or windowing strategy can guarantee exactly-once processing, when in reality it requires both source-level exactly-once delivery and an idempotent sink to handle retries from worker failures.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Enable exactly-once delivery on the Pub/Sub subscription and use an idempotent sink
Pub/Sub subscriptions can be configured with exactly-once delivery (using the `enableExactlyOnceDelivery` flag), which ensures that each message is delivered to the subscriber exactly once. Combining this with an idempotent sink (e.g., Cloud Storage with unique filenames or deduplication logic) guarantees that even if a worker fails and the pipeline retries, the output will not contain duplicates. This is the only option that directly addresses both the source and sink to achieve end-to-end exactly-once semantics.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use a side input from a deduplication dataset
Why it's wrong here
Feasible but not a standard configuration; also adds latency.
- ✗
Set the pipeline to use a global window with no early triggers
Why it's wrong here
Does not address duplicates due to re-execution.
- ✗
Insert a Reshuffle transform after reading
Why it's wrong here
Reshuffle improves parallelism but does not guarantee exactly-once.
- ✓
Enable exactly-once delivery on the Pub/Sub subscription and use an idempotent sink
Why this is correct
Pub/Sub exactly-once delivery and an idempotent Storage write (e.g., using file naming) ensure no duplicates.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
3 more ways this is tested on PDE
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A retail company processes real-time clickstream data using Cloud Pub/Sub and Dataflow. The pipeline aggregates events by user session and writes to Bigtable for low-latency queries. However, users report that session data is sometimes missing or duplicated. What is the most likely cause?
medium- A.Session windowing is configured with too short a gap duration.
- B.Bigtable schema design causes row key collisions.
- C.Dataflow's default behavior discards late-arriving data.
- ✓ D.Pub/Sub provides at-least-once delivery, and Dataflow does not deduplicate by default.
Why D: D is correct because Pub/Sub offers at-least-once delivery, meaning the same message may be delivered multiple times. Dataflow does not automatically deduplicate messages unless explicitly configured (e.g., using idempotent sinks or custom deduplication logic). Without deduplication, the same session event can be processed more than once, leading to duplicate session data in Bigtable.
Variation 2. A data pipeline using Cloud Pub/Sub and Cloud Dataflow is experiencing duplicate messages. The source system publishes messages at least once. What Dataflow technique ensures exactly-once processing?
medium- ✓ A.Use idempotent sinks
- B.Use GlobalWindows
- C.Set watermark threshold
- D.Enable streaming engine
Why A: Idempotent sinks ensure that even if Cloud Pub/Sub delivers the same message multiple times (due to its at-least-once delivery semantics), the Dataflow pipeline can deduplicate or safely reapply the same data without causing duplicates in the output. This is achieved by designing the sink (e.g., BigQuery with insertId, Cloud Storage with unique filenames) to recognize and ignore repeated writes, effectively providing exactly-once processing semantics downstream.
Variation 3. A data engineer is designing a streaming pipeline with Cloud Pub/Sub and Cloud Dataflow. They need to guarantee at-least-once delivery and handle occasional duplicates. Which TWO configurations should they implement?
medium- ✓ A.Use idempotent sinks
- B.Use global windows with triggers
- C.Use fixed windows
- ✓ D.Use at-least-once Pub/Sub subscription
- E.Enable Dataflow Streaming Engine
Why A: Idempotent sinks (e.g., BigQuery with insertId, Cloud Storage with object generation numbers) allow the pipeline to safely process duplicate records without causing data corruption or double-counting. In a streaming pipeline with at-least-once semantics, duplicates are inevitable, and idempotent sinks ensure that repeated writes produce the same result as a single write, maintaining data consistency.
Last reviewed: Jun 30, 2026
This PDE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PDE exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.