exam questions

Exam Professional Cloud Developer All Questions

View all questions & answers for the Professional Cloud Developer exam

Exam Professional Cloud Developer topic 1 question 261 discussion

Actual exam question from Google's Professional Cloud Developer
Question #: 261
Topic #: 1
[All Professional Cloud Developer Questions]

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?

  • A. Install Cloud Code on the integrated development environment (IDE). Navigate to Cloud APIs, and enable Pub/Sub against a valid Google Project ID. When developing locally, configure your application to call pubsub.googleapis.com.
  • B. Install the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project ID. When developing locally, configure your application to use the local emulator with ${gcloud beta emulators pubsub env-init}.
  • C. In the Google Cloud console, navigate to the API Library, and enable the Pub/Sub API. When developing locally, configure your application to call pubsub.googleapis.com.
  • D. Install the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project IWhen developing locally, configure your application to use the local emulator by exporting the PUBSUB_EMULATOR_HOST variable.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
GCP001
4 months, 1 week ago
Selected Answer: B
I will go with B. PUBSUB_EMULATOR_HOST is additional option if local emulator and app is running in different machine. It can also be used on same machine. But if it is same localhost, gcloud beta emulators pubsub env-init is the easy approach. https://cloud.google.com/pubsub/docs/emulator
upvoted 1 times
...
alpha_canary
6 months, 3 weeks ago
Selected Answer: B
Here we have only single machine, so just using the terminal command is OK, no need to export ENV variables https://cloud.google.com/pubsub/docs/emulator#automatically_setting_the_variables
upvoted 1 times
...
examprof
11 months ago
Alternative B is correct. Link: https://cloud.google.com/pubsub/docs/emulator#env Executing "gcloud beta emulators pubsub env-init" is required for local testing when the application and the emulator run either on the same machine or on different machines. The export of the PUBSUB_EMULATOR_HOST variable is an additional step required only in the latter case (when the application and the emulator run on different machines).
upvoted 2 times
...
plutonians123
11 months ago
Selected Answer: B
Based on the common steps for implementing the Pub/Sub emulator, the best choice for configuring local testing of your web application's Pub/Sub integration would be: Option B: Install the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project ID. When developing locally, configure your application to use the local emulator with ${gcloud beta emulators pubsub env-init}. This option covers the essential steps for both scenarios (same machine or different machines) and provides a clear path for setting up and utilizing the Pub/Sub emulator effectively for local development and testing.
upvoted 1 times
...
__rajan__
1 year, 1 month ago
Selected Answer: D
This approach allows you to test your application’s integration with Pub/Sub without making actual calls to the Pub/Sub service, which can be time-consuming and may incur costs. Instead, your application interacts with the local emulator, which mimics the behavior of the actual Pub/Sub service. This makes it a fast and cost-effective solution for local testing. Remember to set the PUBSUB_EMULATOR_HOST environment variable to point your application to the local emulator.
upvoted 1 times
...
[Removed]
1 year, 4 months ago
Selected Answer: B
https://cloud.google.com/pubsub/docs/emulator#automatically_setting_the_variables If your application and the emulator run on the same machine, you can set the environment variables automatically with: 1) $(gcloud beta emulators pubsub env-init) If your application and the emulator run on different machines, set the environment variables manually with: 1) Run the env-init command: gcloud beta emulators pubsub env-init 2) On the machine that runs your application, set the PUBSUB_EMULATOR_HOST
upvoted 3 times
...
sbonessi
1 year, 5 months ago
Selected Answer: B
I agree with B as the correct answer. https://cloud.google.com/pubsub/docs/emulator#automatically_setting_the_variables You can run gcloud beta emulators pubsub env-init in your own localhost within if your application and the emulator run on the same machine
upvoted 1 times
...
Writer
1 year, 6 months ago
Selected Answer: D
Answer: D
upvoted 1 times
...
Writer
1 year, 6 months ago
Answer: D
upvoted 1 times
...
closer89
1 year, 6 months ago
Selected Answer: D
gcloud beta emulators pubsub start --project=my-project-id export PUBSUB_EMULATOR_HOST=localhost:8085 export GOOGLE_CLOUD_PROJECT=my-project-id
upvoted 1 times
closer89
1 year, 6 months ago
its B https://cloud.google.com/pubsub/docs/emulator#automatically_setting_the_variables
upvoted 4 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago