PROFESSIONAL-CLOUD-DEVELOPER · Question #293
You recently developed an application that monitors a large number of stock prices. You need to configure Pub/Sub to receive a high volume messages and update the current stock price in a single…
The correct answer is C. Create a push subscription with exactly-once delivery enabled. A push subscription with exactly-once delivery is appropriate here. Push mode has Pub/Sub proactively deliver messages to your endpoint as they arrive, giving the in-memory database near-real-time updates with minimal latency. Exactly-once delivery ensures each stock price…
Question
You recently developed an application that monitors a large number of stock prices. You need to configure Pub/Sub to receive a high volume messages and update the current stock price in a single large in-memory database. A downstream service needs the most up-to-date prices in the in-memory database to perform stock trading transactions. Each message contains three pieces or information:
- Stock symbol
- Stock price
- Timestamp for the update
How should you set up your Pub/Sub subscription?
Options
- ACreate a pull subscription with exactly-once delivery enabled.
- BCreate a push subscription with both ordering and exactly-once delivery turned off.
- CCreate a push subscription with exactly-once delivery enabled.
- DCreate a pull subscription with both ordering and exactly-once delivery turned off.
How the community answered
(38 responses)- A16% (6)
- B8% (3)
- C71% (27)
- D5% (2)
Explanation
A push subscription with exactly-once delivery is appropriate here. Push mode has Pub/Sub proactively deliver messages to your endpoint as they arrive, giving the in-memory database near-real-time updates with minimal latency. Exactly-once delivery ensures each stock price update is applied exactly one time - critical for an in-memory store where duplicate writes could corrupt the current price or trigger erroneous trades. Pull subscriptions (A, D) require the consumer to request messages, introducing polling delays that are unsuitable for high-frequency stock updates. Option B turns off exactly-once delivery, risking duplicate price writes. Option D also disables ordering and exactly-once, meaning an older price could overwrite a newer one and duplicates could occur.
Topics
Community Discussion
No community discussion yet for this question.