Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
You are designing an asynchronous order-processing architecture using Google Cloud Pub/Sub. Your e-commerce backend publishes thousands of order events per second to a single order-events topic. Two independent downstream services must each receive a copy of every order event:
How should you configure the Pub/Sub subscriptions and subscriber clients to meet these requirements?
order-events topic: a pull subscription for the Inventory Service using the low-level client library with unary Pull and returnImmediately set to true, and a push subscription for the Notification Webhook.The low-level auto-generated client library exposes direct gRPC and REST wrappers around the Pub/Sub service APIs, including the unary Pull API. Unlike StreamingPull, unary Pull operates on a traditional request-and-response model where each pull request returns at most one response containing available messages.
returnImmediately: Setting returnImmediately to true instructs Pub/Sub to reply immediately even when no messages are ready. This field is deprecated and severely degrades pull efficiency and latency by generating excessive empty polling round-trips.The Inventory Service were constrained to a strictly synchronous programming model with tight memory or CPU ceilings where low latency and high throughput were secondary to controlling the exact number of messages pulled per request (and without using the deprecated returnImmediately flag).
order-events topic—one targeting the Inventory Service and one targeting the Notification Webhook—and configure publisher-side batching to absorb traffic spikes.A push subscription relies on Pub/Sub servers to initiate HTTP POST requests to a subscriber's registered endpoint whenever messages arrive. Publisher-side batching groups multiple outbound messages into a single publish request on the producer side to reduce API calls and improve publishing efficiency.
maxOutstandingMessages or maxOutstandingBytes and can only signal overload by returning HTTP error codes.Both downstream services were lightweight, publicly accessible HTTPS webhooks (such as Cloud Run functions or App Engine apps) handling moderate message rates without importing Pub/Sub client libraries.
order-events topic and connect both the Inventory Service and a polling worker for the Notification Webhook to consume messages from it.Connecting multiple subscriber applications to a single Pub/Sub subscription implements a load-balanced (many-to-many) pattern rather than a fan-out pattern. When multiple consumers pull from the same subscription, Pub/Sub leases each individual message to only one active subscriber client at a time to distribute processing load horizontally.
You wanted to scale a single logical service—such as deploying multiple identical worker instances of the Inventory Service—so they share the workload and process disjoint subsets of messages in parallel.
order-events topic: a pull subscription for the Inventory Service using the high-level client library with StreamingPull and subscriber flow control, and a push subscription for the Notification Webhook.In Pub/Sub, attaching multiple subscriptions to a single topic implements a fan-out (one-to-many) messaging pattern, ensuring that every attached subscription receives a complete copy of all published messages. Pairing each subscription with the delivery mechanism tailored to its consumer's architecture—pull for high-throughput internal services and push for lightweight serverless webhooks—allows disparate systems to consume the same event stream asynchronously.
order-events guarantees that both the Inventory Service and the Notification Webhook receive every order message independently.maximum outstanding messages and total outstanding message bytes), pausing message delivery when local capacity is reached until messages are acknowledged or autoscaling completes.Unlike sharing a single subscription or forcing both consumers onto push or unary pull, combining separate fan-out subscriptions with StreamingPull and push delivery aligns directly with each workload's network boundaries, library constraints, and throughput demands.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated