PROFESSIONAL-CLOUD-DEVELOPER · Question #278
You have a web application that publishes messages to Pub/Sub. You plan to build new versions of the application locally and want to quickly test Pub/Sub integration for each new build. How should you
The correct answer is B. Install the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project ID.. The Pub/Sub emulator is the correct tool for fast, local integration testing because it runs entirely offline, incurs no costs, and does not require network access to Google Cloud. Installing it via gcloud components install pubsub-emulator and starting it with a valid Google Pro
Question
You have a web application that publishes messages to Pub/Sub. You plan to build new versions of the application locally and want to quickly test Pub/Sub integration for each new build. How should you configure local testing?
Options
- AInstall Cloud Code on the integrated development environment (IDE). Navigate to Cloud APIs,
- BInstall the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project ID.
- CIn the Google Cloud console, navigate to the API Library, and enable the Pub/Sub API. When
- DInstall the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project
How the community answered
(47 responses)- A6% (3)
- B77% (36)
- C13% (6)
- D4% (2)
Explanation
The Pub/Sub emulator is the correct tool for fast, local integration testing because it runs entirely offline, incurs no costs, and does not require network access to Google Cloud. Installing it via gcloud components install pubsub-emulator and starting it with a valid Google Project ID (used as a namespace, not for actual authentication) lets developers send and receive messages locally as if using the real service. Option A (Cloud Code IDE navigation) connects to live Cloud APIs - not a local test. Option C (enabling the API in the console) uses real Pub/Sub with real network calls and costs. Option D appears similar to B but is incorrect based on the question's context, likely differing in a key configuration detail such as using an invalid or placeholder Project ID, which would cause the emulator to fail to start.
Topics
Community Discussion
No community discussion yet for this question.