How to prevent duplicate processing in Pub/Sub pull subscriptions?
Your chemical company needs to manually check documentation for customer order. You use a pull subscription in Pub/Sub so that sales agents get details from the order. You must ensure that you do not process orders twice with different sales agents and that you do not add more complexity to this workflow. What should you do?
Community Votes
100% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
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.
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.
Community Discussion (7 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
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
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.