Topic 1 Question 276
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?
Create a pull subscription with exactly-once delivery enabled.
Create a push subscription with both ordering and exactly-once delivery turned off.
Create a push subscription with exactly-once delivery enabled.
Create a pull subscription with both ordering and exactly-once delivery turned off.
ユーザの投票
コメント(7)
C is correct (I am not a contributor, so unable to vote). Rationale:
The downstream application needs only the most up-to-date value for a stock price. There's no need of historical values from a time series, so "ordering" does not make any sense in this scenario. This eliminates alternatives B and D.
Next choice is between "push" and "pull". In a "push" subscription, whenever the topic is fed with a new value, it will keep pushing it to the application until an acknowledgement is received. Latency is lower in this case. In a "pull" subscription, there's an additional burden on the application to keep pulling from the topic. This increases latency. A "push" subscription is recommended in such scenarios.
👍 2pbrvgl2023/12/03https://cloud.google.com/pubsub/docs/exactly-once-delivery "This page explains how to receive and acknowledge messages using exactly-once semantics. Only the pull subscription type supports exactly-once delivery, including subscribers that use the StreamingPull API.
Push and export subscriptions don't support exactly-once delivery."
👍 2Adpese_12023/12/19Given the requirement for maintaining the most up-to-date stock prices in the in-memory database for trading transactions, the suitable setup for the Pub/Sub subscription would be option C: Create a push subscription with exactly-once delivery enabled. This ensures that messages are reliably delivered and processed exactly once, avoiding duplicates and ensuring that the downstream service receives the most recent stock price updates for accurate trading decisions.
👍 1MFay2023/12/01
シャッフルモード