Google Professional Cloud Developer Question 391
Single answerGoogle Cloud PlatformYou are developing a cloud-based application that processes and analyzes large datasets stored in Google Cloud Storage. The application requires frequent updates to the dataset and needs to trigger a data processing workflow whenever new data is uploaded. Which approach would best integrate your application with Google Cloud Storage to meet these requirements?
- A
Use Pub/Sub notifications for Cloud Storage to trigger the data processing workflow in your application.
- B
Set up a Cloud Scheduler job to periodically check for new files in the Cloud Storage bucket.
- C
Use the Cloud Storage JSON API to continuously poll the bucket for changes and trigger the workflow.
- D
Leverage Firebase Realtime Database to monitor changes in the Cloud Storage bucket and trigger the workflow.
Show answer and explanation
Correct answer: A
Explanation
The best approach to integrate an application with Google Cloud Storage for triggering workflows on new uploads is to use Pub/Sub notifications. This feature allows the application to subscribe to notifications about changes in a Cloud Storage bucket, ensuring near real-time processing without unnecessary overhead like polling. Other options, such as Cloud Scheduler or continuous polling, are less efficient and do not align with best practices for cloud application development.
- A. Correct.
This is the correct option. Pub/Sub notifications for Cloud Storage are specifically designed to notify applications when changes occur in a bucket, such as file uploads. This approach minimizes latency and avoids unnecessary polling.
- B. Incorrect.
This is an incorrect option. While Cloud Scheduler can automate periodic tasks, it is not an efficient method for detecting new uploads in near real-time, as it relies on fixed intervals, leading to potential delays or unnecessary resource usage.
- C. Incorrect.
This is an incorrect option. Continuously polling a Cloud Storage bucket using the JSON API is inefficient and can lead to higher costs due to excessive API calls, especially for frequently updated datasets.
- D. Incorrect.
This is an incorrect option. Firebase Realtime Database is not designed to monitor changes in Cloud Storage buckets, and there is no native integration for such use cases.