You receive frequent stock price messages containing symbol, price, and timestamp. You must update an in-memory store so a downstream service always sees the latest price. How should you configure the Pub/Sub subscription?
Choose an answer
Tap an option to check your answer.
Correct answer: Create a pull subscription with ordering enabled and use the stock symbol as the ordering key..
Why this is the answer
For frequent updates like stock prices where only the latest value matters, message ordering is crucial. A pull subscription with ordering enabled ensures messages for the same stock symbol (used as the ordering key) are delivered in the order they were published. This allows your in-memory store to correctly update with the most recent price. Exactly-once delivery isn't strictly necessary here because a later message for the same stock will simply overwrite any previous, potentially duplicate, update. Push subscriptions are less suitable for maintaining ordered state as they push messages to an endpoint, making it harder to guarantee processing order for related messages. Disabling ordering would lead to incorrect price updates if messages arrive out of sequence.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed