PROFESSIONAL-CLOUD-DEVELOPER · Question #266
You are developing an event-driven application. You have created a topic to receive messages sent to Pub/Sub. You want those messages to be processed in real time. You need the application to be indep
The correct answer is D. Deploy your code on Cloud Functions. Use a Pub/Sub trigger to handle new messages in the. Cloud Functions with a Pub/Sub trigger is the optimal architecture for event-driven, real-time processing that only incurs costs when messages arrive. Cloud Functions is serverless-it scales to zero when idle and charges only for execution time, directly satisfying the cost requi
Question
You are developing an event-driven application. You have created a topic to receive messages sent to Pub/Sub. You want those messages to be processed in real time. You need the application to be independent from any other system and only incur costs when new messages arrive. How should you configure the architecture?
Options
- ADeploy the application on Compute Engine. Use a Pub/Sub push subscription to process new
- BDeploy your code on Cloud Functions. Use a Pub/Sub trigger to invoke the Cloud Function. Use
- CDeploy the application on Google Kubernetes Engine. Use the Pub/Sub API to create a pull
- DDeploy your code on Cloud Functions. Use a Pub/Sub trigger to handle new messages in the
How the community answered
(21 responses)- A5% (1)
- B10% (2)
- C14% (3)
- D71% (15)
Explanation
Cloud Functions with a Pub/Sub trigger is the optimal architecture for event-driven, real-time processing that only incurs costs when messages arrive. Cloud Functions is serverless-it scales to zero when idle and charges only for execution time, directly satisfying the cost requirement. A Pub/Sub trigger invokes the function automatically for each new message, enabling real-time processing without polling. Choice A (Compute Engine) always incurs costs regardless of message volume. Choice C (GKE) runs a persistent cluster that incurs costs even with no messages. Choice B is similar but may imply a different subscription model; Choice D represents the canonical, simplest serverless pattern using the native Pub/Sub trigger integration.
Topics
Community Discussion
No community discussion yet for this question.