Google Cloud Professional Data Engineer — Question 212
You work for a large ecommerce company. You are using Pub/Sub to ingest the clickstream data to Google Cloud for analytics. You observe that when a new subscriber connects to an existing topic to analyze data, they are unable to subscribe to older data. For an upcoming yearly sale event in two months, you need a solution that, once implemented, will enable any new subscriber to read the last 30 days of data. What should you do?
Answer options
- A. Create a new topic, and publish the last 30 days of data each time a new subscriber connects to an existing topic.
- B. Set the topic retention policy to 30 days.
- C. Set the subscriber retention policy to 30 days.
- D. Ask the source system to re-push the data to Pub/Sub, and subscribe to it.
Correct answer: B
Explanation
The correct answer is B because adjusting the topic retention policy allows the topic to retain messages for 30 days, enabling any new subscriber to access the last month's data. The other options are ineffective; creating a new topic (A) does not solve the problem, modifying the subscriber retention policy (C) does not impact the data availability in the topic, and re-pushing data (D) is not a feasible or efficient solution.