Google Professional Cloud Developer exam dumps

Google Professional Cloud Developer practice question 414 of 481

Professional Cloud Developer. Professional level, Google Cloud. Free question with the correct answer and a full explanation.

Google Professional Cloud Developer Question 414

Single answerGoogle Cloud Platform

You are developing a financial application that processes real-time stock price updates. The application must consume messages from a Pub/Sub topic and ensure that the messages are processed exactly once, even in the event of a crash or failure. Which approach should you take to meet this requirement?

  1. A

    Use a Pub/Sub subscription with message acknowledgment and implement a retry mechanism in your application to handle failures.

  2. B

    Use a Pub/Sub subscription with message acknowledgment and set the subscription to retain acknowledged messages for reprocessing.

  3. C

    Use a Pub/Sub subscription with message acknowledgment and enable Dead Letter Topics (DLTs) for failed messages.

  4. D

    Use a Pub/Sub subscription with the 'at-most-once' delivery guarantee to ensure each message is processed exactly once.

Show answer and explanation

Correct answer: A

Explanation

To ensure exactly-once processing of messages in Google Cloud Pub/Sub, the application must acknowledge messages after successful processing. This acknowledgment mechanism ensures that Pub/Sub does not redeliver the message. Additionally, implementing a retry mechanism helps handle transient failures and ensures message processing reliability. Other options either do not meet the exactly-once requirement or are focused on different use cases like debugging or deduplication.

  • A. Correct.

    This is correct. Using a Pub/Sub subscription with message acknowledgment ensures messages are processed exactly once, as the acknowledgment acts as a confirmation to Pub/Sub that the message has been successfully processed. Implementing a retry mechanism helps handle failures and ensures reliability.

  • B. Incorrect.

    This is incorrect. Retaining acknowledged messages would not ensure exactly-once delivery, as the application would need to handle deduplication, which can lead to complications and additional processing.

  • C. Incorrect.

    This is incorrect. While Dead Letter Topics (DLTs) help in handling undeliverable messages, they do not guarantee exactly-once processing. They are used for identifying and debugging failed messages.

  • D. Incorrect.

    This is incorrect. The 'at-most-once' delivery guarantee means messages are delivered at most once, which can result in message loss and does not meet the requirement for exactly-once processing.

Timed practice exam

Take a Google Professional Cloud Developer practice test under exam conditions

60 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam