How to prevent duplicate processing in Pub/Sub pull subscriptions?
Short answer
C Use Pub/Sub exactly-once delivery in your pull subscription.
Question
Key Takeaways
This question tests knowledge of native Pub/Sub features, specifically exactly-once delivery, while trapping candidates who might over-engineer a solution using Dataflow or databases.
To prevent duplicate message processing in Google Cloud Pub/Sub pull subscriptions without adding workflow complexity, you should utilize the platform's native exactly-once delivery feature. The community confirms this is the most efficient method compared to external solutions like Dataflow.
Common mistake: Choosing Option A (Dataflow Deduplicate PTransform) is a common mistake because, while it solves the deduplication issue, it violates the requirement to avoid adding complexity to the workflow.
Expert Analysis
Why the Answer Is Correct
Option C is correct because Google Cloud Pub/Sub offers exactly-once delivery, which ensures that each message is delivered to the subscriber exactly once, even in the event of network errors or retries. This feature directly addresses the requirement to prevent orders from being processed twice by different sales agents. It achieves this natively without requiring additional infrastructure, thereby adhering to the constraint of not adding complexity to the workflow.
Why the Other Options Are Wrong
Option A is incorrect because using a Deduplicate PTransform in Dataflow introduces an additional data processing pipeline, which significantly increases architectural and operational complexity. Option B is incorrect because implementing a transactional database to monitor messages requires custom state management and infrastructure, adding unnecessary overhead. Option D is incorrect because switching to a push subscription does not inherently solve the deduplication requirement and alters the existing workflow architecture without providing a clear benefit for preventing duplicate processing.
Community Comment Notes
The community strongly supports Option C, with multiple users citing the official Google Cloud documentation on exactly-once delivery. Comment [4] provides a detailed explanation of why Option A is incorrect, specifically noting that Dataflow adds complexity that contradicts the question's constraints. While comment [5] raises a theoretical concern about multiple subscribers, the consensus remains that exactly-once delivery is the intended solution for the described scenario.
Official Reference
https://cloud.google.com/pubsub/docs/exactly-once-delivery
This link opens the official vendor documentation in a new tab.
Exam Strategy
When answering questions about data reliability, always prioritize native service features over building custom solutions or adding complex pipelines. Look for keywords like 'complexity' or 'maintenance' as indicators to choose the simplest, managed service option.
Community Votes
100% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 7 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 7
-
meh_33 👍 12Believe me all questions were from Exam topic all were there yesterday in exam. But yes dont go with starting questions mainly focus questions after 200 and latest questions are at last page.
-
JimmyBK 👍 7 Answered CI remember seeing this in the exam.
-
AllenChen123 👍 4 Answered CStraightforward. https://cloud.google.com/pubsub/docs/exactly-once-delivery
-
Pime13 👍 1 Answered Chttps://cloud.google.com/pubsub/docs/exactly-once-delivery Option A, using a Deduplicate PTransform in Dataflow, could help remove duplicate messages, but it adds complexity to your workflow. Dataflow is a separate service that would need to be integrated and managed, which might not be necessary if Pub/Sub's exactly-once delivery can handle the deduplication for you. Using Pub/Sub's exactly-once delivery (Option C) is a more straightforward solution that directly addresses the issue of duplicate processing without adding extra components to your system.
-
cien91 👍 1 Answered AWhy not C - Exactly-once delivery in Pub/Sub guarantees that a message is delivered to a subscriber exactly once. However, it doesn't prevent multiple subscribers from processing the same message.
Show 2 more comments
-
Sofiia98 👍 1 Answered CC, of course
-
JyoGCP 👍 1 Answered COption C
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.