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?

  1. Use a Deduplicate PTransform in Dataflow before sending the messages to the sales agents.
  2. Create a transactional database that monitors the pending messages.
  3. Use Pub/Sub exactly-once delivery in your pull subscription. Source Reference Answer
  4. Create a new Pub/Sub push subscription to monitor the orders processed in the agent's system.

Community Votes

C
100%

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)

meh_33 👍 12
Believe 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 Selected: C
I remember seeing this in the exam.
Pime13 👍 1 Selected: C
https://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 Selected: A
Why 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.
JyoGCP 👍 1 Selected: C
Option C
Sofiia98 👍 1 Selected: C
C, of course
AllenChen123 👍 4 Selected: C
Straightforward. https://cloud.google.com/pubsub/docs/exactly-once-delivery

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

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.

Related Analysis

← Back to PDE Study Guide