nerdexam
Google

PROFESSIONAL-CLOUD-DEVELOPER · Question #169

You are a developer working on an internal application for payroll processing. You are building a component of the application that allows an employee to submit a timesheet, which then initiates…

The correct answer is C. Create a Pub/Sub topic for timesheet submissions. Create a subscription for each downstream. The correct pattern is a single Pub/Sub topic for timesheet submissions with one subscription per downstream consumer (email service, payroll API, data warehouse). This is a classic fan-out publish-subscribe pattern. Each team creates and manages their own subscription…

Designing highly scalable, available, and reliable cloud-native applications

Question

You are a developer working on an internal application for payroll processing. You are building a component of the application that allows an employee to submit a timesheet, which then initiates several steps:

  • An email is sent to the employee and manager, notifying them that the

timesheet was submitted.

  • A timesheet is sent to payroll processing for the vendor's API.
  • A timesheet is sent to the data warehouse for headcount planning.

These steps are not dependent on each other and can be completed in any order. New steps are being considered and will be implemented by different development teams. Each development team will implement the error handling specific to their step. What should you do?

Options

  • ADeploy a Cloud Function for each step that calls the corresponding downstream system to
  • BCreate a Pub/Sub topic for each step. Create a subscription for each downstream development
  • CCreate a Pub/Sub topic for timesheet submissions. Create a subscription for each downstream
  • DCreate a timesheet microservice deployed to Google Kubernetes Engine. The microservice calls

How the community answered

(47 responses)
  • A
    2% (1)
  • B
    11% (5)
  • C
    83% (39)
  • D
    4% (2)

Explanation

The correct pattern is a single Pub/Sub topic for timesheet submissions with one subscription per downstream consumer (email service, payroll API, data warehouse). This is a classic fan-out publish-subscribe pattern. Each team creates and manages their own subscription independently - including their own error handling and retry logic - without any coordination required with the publisher or other teams. Adding a new step means adding a new subscription, with zero changes to existing code. Option B (one topic per step) inverts the model - the publisher would need to know about all consumers. Option D (a microservice calling all systems) tightly couples the steps and requires that microservice to be updated whenever a new step is added.

Topics

#Pub/Sub#Event-driven architecture#Loose coupling#Asynchronous processing

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVELOPER Practice