Google Professional Cloud Developer Question 410
Select 3Google Cloud PlatformYou are building a serverless application that processes incoming data asynchronously from multiple IoT devices. Each device sends data to a specific topic in Pub/Sub. You want to ensure that message processing is reliable, scalable, and that messages are not lost if your application crashes. Which of the following steps should you implement to achieve these requirements?
- A
Use a Pub/Sub subscription with message acknowledgment enabled in your application.
- B
Implement message deduplication logic in your application to handle duplicate messages.
- C
Set up a Dead Letter Topic (DLT) for messages that cannot be successfully processed after multiple attempts.
- D
Use a single-threaded subscriber to maintain message order across topics.
- E
Leverage Cloud Run with a Pub/Sub trigger to automatically scale based on incoming message volume.
Show answer and explanation
Correct answers: A, C, E
Explanation
To process Pub/Sub messages reliably and at scale, you should enable message acknowledgment to ensure successful processing and prevent duplicates, set up a Dead Letter Topic to handle unprocessed messages, and use Cloud Run with Pub/Sub triggers to automatically scale your application based on message volume. These steps align with best practices for building asynchronous, scalable applications on Google Cloud.
- A. Correct.
Acknowledging messages ensures Pub/Sub does not redeliver the same message repeatedly and confirms successful processing on your application's side.
- B. Incorrect.
Message deduplication is not inherently required unless your specific use case demands it. Pub/Sub already provides at-least-once delivery, so it is not a strict requirement for reliable processing.
- C. Correct.
Setting up a Dead Letter Topic (DLT) ensures that unprocessed messages are not lost and can be analyzed or retried later.
- D. Incorrect.
Using a single-threaded subscriber is not scalable for high message volumes and is not necessary unless strict message ordering across topics is required, which is not a requirement in this scenario.
- E. Correct.
Cloud Run with Pub/Sub triggers provides serverless scalability, ensuring that your application can handle spikes in message volume without manual intervention.