Professional Cloud Developer · Free Practice Question Medium
Question 26
An event-driven application is being developed, and a topic has been created to receive messages sent to Pub/Sub. The objective is to process these messages in real-time while ensuring the application's independence from any other system. Additionally, the application should incur costs only when new messages arrive.
What is the recommended configuration for the architecture?
- A Deploy the application on Google Kubernetes Engine. Use the Pub/Sub API to create a pull subscription to the Pub/Sub topic and retrieve messages from it.
- B Deploy the application on Compute Engine. Use a Pub/Sub push subscription to process new messages in the topic.
- C Deploy your code on Cloud Functions. Use a Pub/Sub trigger to handle new messages in the topic.
- D Deploy your code on Cloud Functions. Use a Pub/Sub trigger to invoke the Cloud Function. Use the Pub/Sub API to create a pull subscription to the Pub/Sub topic and retrieve messages from it.
Reveal correct answer
Correct answer: D
Explanation
To develop an event-driven application that processes messages in real time, it is recommended to use Cloud Functions with a Pub/Sub trigger. This approach allows the application to be independent from any other system and only incur costs when new messages arrive. According to the Professional Google Cloud Developer documentation, ""you can use Cloud Functions to automatically respond to events in your Cloud Pub/Sub topics, so your application can react to new messages and process them in real time. By default, Cloud Functions only incur costs when your code is running, so you only pay for the time your code is processing messages."" Additionally, creating a pull subscription to the Pub/Sub topic and using the Pub/Sub API to read messages from it allows for greater control and flexibility in managing message processing.Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
You must be logged in to post a comment.
