
Answer-first summary for fast verification
Answer: Create a pull subscription with ordering enabled, using the stock symbol as the ordering key.
The correct answer is C because the scenario requires maintaining the most up-to-date stock prices in the in-memory database, which necessitates processing messages in the order they were published for each stock symbol. Creating a pull subscription with ordering enabled, using the stock symbol as the ordering key, ensures that all messages for the same stock are processed sequentially, preventing older updates from overwriting newer ones. This approach aligns with the requirement for the downstream service to have access to the latest prices for stock trading transactions. The other options either do not support the necessary ordering (A and B) or are not suitable for the scenario (D).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
How should you configure a Pub/Sub subscription for an application that monitors stock prices, where each message contains a stock symbol, price, and timestamp, to ensure downstream services always access the most recent prices in an in-memory database for trading transactions?
A
Create a push subscription with exactly-once delivery enabled.
B
Create a pull subscription with both ordering and exactly-once delivery turned off.
C
Create a pull subscription with ordering enabled, using the stock symbol as the ordering key.
D
Create a push subscription with both ordering and exactly-once delivery turned off.
No comments yet.