Professional Cloud Developer Exam QuestionsBrowse all questions from this exam

Professional Cloud Developer Exam - Question 249


You are developing an event-driven application. You have created a topic to receive messages sent to Pub/Sub. You want those messages to be processed in real time. You need the application to be independent from any other system and only incur costs when new messages arrive. How should you configure the architecture?

Show Answer
Correct Answer: BD

For an event-driven architecture where the application should only incur costs when new messages arrive, deploying the code on Cloud Functions using a Pub/Sub trigger to handle new messages in the topic is the most suitable solution. Cloud Functions are serverless and scale automatically with the workload. They only run and incur costs when they are triggered by new messages, ensuring real-time processing without the need for manual pull subscription management, which simplifies the configuration.

Discussion

12 comments
Sign in to comment
mrvergaraOption: B
Feb 4, 2023

Option D is not ideal because using a Pub/Sub trigger to handle new messages in a topic is not the most efficient way to process messages in real time. In a trigger-based architecture, Cloud Functions are invoked only when new messages are available, so there is a possibility of delays in processing. On the other hand, Option B provides a more efficient architecture for real-time processing. A Cloud Function is invoked for each message received in the Pub/Sub topic, providing immediate processing as messages arrive. This way, the application is independent from any other system and incurs costs only when new messages arrive, fulfilling the requirements stated in the question.

NewComer200Option: D
May 1, 2023

Selected Answer:D https://cloud.google.com/functions/docs/calling/pubsub We selected D based on our experience with Cloud Functions and the material at the URL above. Since messages can be obtained from Cloud Functions arguments, we are not aware of the description of Subscription. "only incur costs when new messages arrive." so it's OK to process on the trigger. I don't think real time means so strictly. For the life of me, I can't find any reason why D is wrong, and it seems to me that B is an error because of the extra processing.

Pime13
Mar 2, 2023

took my exam yesterday (01-03-2023) and this question was there

imiu
Dec 1, 2023

and what is the answer? option D?

TNT87Option: B
Feb 1, 2023

https://cloud.google.com/solutions/event-driven-architecture-pubsub

NewComer200Option: D
May 1, 2023

Selected Answer:D https://cloud.google.com/functions/docs/calling/pubsub We selected D based on our experience with Cloud Functions and the material at the URL above. Since messages can be obtained from Cloud Functions arguments, we are not aware of the description of Subscription.

purushiOption: B
Aug 8, 2023

B is a very detailed answer and it is a right choice. D is missing info like cloud function to subscribe pub sub topic to handle new messages.

alpha_canaryOption: D
Apr 10, 2024

D: Deploying your code on Cloud Functions and using a Pub/Sub trigger to handle new messages in the topic allows for a real-time, event-driven architecture. Cloud Functions only incur costs when invoked, which aligns with the requirement to only incur costs when new messages arrive. B: With Cloud Functions, there's no need to manually create a pull subscription. The Pub/Sub trigger handles the message retrieval.

RajanOption: D
Sep 24, 2023

I would go with D.

RaghuNandaOption: D
Oct 7, 2023

Not sure why we are complicating!! D is the right option

examprofOption: D
Dec 3, 2023

Alternative D is correct. A "push subscription" (not "pull"!) is more suitable when messages must be processed in real-time. Message ingested in the Pub/Sub topic, message pushed and retried recurrently until acknowledged.

JonathanSJOption: D
Feb 5, 2024

I will go for D.

d_ella2001Option: D
Jul 12, 2024

This option is the most suitable. Cloud Functions are fully managed and serverless, meaning you only incur costs when your code is executed in response to incoming messages. Using a Pub/Sub trigger ensures that the Cloud Function is invoked in real-time when new messages arrive in the topic, perfectly aligning with the requirements.