Google Professional Cloud Developer Question 419
Single answerGoogle Cloud PlatformYou are building a serverless application that processes incoming user-uploaded images. When an image is uploaded to a Cloud Storage bucket, you want the application to trigger a series of steps: (1) validate the image, (2) perform image processing, and (3) store metadata in Firestore. Each step should be executed in sequence, and any errors in one step should stop subsequent steps. Which combination of tools should you use to orchestrate this workflow?
- A
Use Workflows to define the sequence of steps, and trigger it using Eventarc when a file is uploaded to the Cloud Storage bucket.
- B
Use Cloud Scheduler to periodically check the Cloud Storage bucket for new files, and trigger a Cloud Function for validation.
- C
Use Cloud Tasks to enqueue each step as a task, with a Cloud Function processing each task in sequence.
- D
Use Eventarc to directly trigger three separate Cloud Functions for each step when a file is uploaded.
Show answer and explanation
Correct answer: A
Explanation
Workflows is the ideal choice for orchestrating a sequence of dependent steps with proper error handling and retry mechanisms. Eventarc integrates seamlessly with Workflows, enabling event-driven execution when a file is uploaded to Cloud Storage. Other tools like Cloud Scheduler, Cloud Tasks, or Eventarc alone are not sufficient for orchestrating the sequential and dependent tasks required in this scenario.
- A. Correct.
Correct. Workflows is designed for orchestrating sequences of tasks with error handling and retries. Eventarc can trigger the workflow when an event, such as a file upload to Cloud Storage, occurs.
- B. Incorrect.
Incorrect. Cloud Scheduler is not suited for event-driven workflows like this. It is used for time-based job scheduling, not real-time event handling.
- C. Incorrect.
Incorrect. While Cloud Tasks can manage task queues, it is not designed for orchestrating sequential workflows with interdependent steps.
- D. Incorrect.
Incorrect. Eventarc can trigger multiple Cloud Functions, but it operates in parallel, not sequentially, and does not provide orchestration or error handling between steps.