You must process Pub/Sub messages exactly once and store the results using the simplest, least expensive approach. What should you do?
Choose an answer
Tap an option to check your answer.
Correct answer: Process the messages with a Dataflow streaming pipeline using Apache Beam's PubSubIO package, and write the output to storage..
Why this is the answer
The correct answer is to process messages with a Dataflow streaming pipeline using Apache Beam's PubSubIO package and write the output to storage. Dataflow, especially with Apache Beam, inherently supports "exactly-once" processing semantics for streaming data, including Pub/Sub messages. This ensures each message is processed and its effect is reflected in the output exactly one time, which directly addresses the "exactly once" requirement. Writing to storage (like Cloud Storage or BigQuery) is a common and cost-effective way to store results. Using a Dataproc job is less suitable for real-time, exactly-once streaming processing; it's typically for batch processing. Cloud Functions are event-driven but don't natively guarantee exactly-once processing for streams without additional complex logic, and deduplicating in BigQuery after the fact adds complexity and cost. Storing in Bigtable and then using another Dataflow pipeline for deduplication is overly complex and expensive, as Dataflow can handle deduplication within a single pipeline.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed