How Can New Pub/Sub Subscribers Read the Last 30 Days of Clickstream Data?

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?

  1. Create a new topic, and publish the last 30 days of data each time a new subscriber connects to an existing topic.
  2. Set the topic retention policy to 30 days. Source Reference Answer
  3. Set the subscriber retention policy to 30 days.
  4. Ask the source system to re-push the data to Pub/Sub, and subscribe to it.

Community Votes

B
100%

100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

The exam tests the difference between topic retention (up to 31 days, benefits all future subscribers) and subscription retention (max 7 days, only affects one existing subscription) — the trap is confusing the two retention settings.

Setting a 30-day message retention policy on the Pub/Sub topic allows any new subscriber created later to seek back and consume the last 30 days of published clickstream data. The community unanimously (100%) supports answer B, since topic-level retention applies to messages regardless of when a subscription is created.

Choosing C (subscriber retention policy) because 'retention' appears in both settings; subscription retention is capped at 7 days and only applies to that single pre-existing subscription, so it cannot give new subscribers 30 days of history.

Community Discussion (8 comments)

raaad 👍 11 Selected: B
  • Topic Retention Policy: This policy determines how long messages are retained by Pub/Sub after they are published, even if they have not been acknowledged (consumed) by any subscriber. - 30 Days Retention: By setting the retention policy of the topic to 30 days, all messages published to this topic will be available for consumption for 30 days. This means any new subscriber connecting to the topic can access and analyze data from the past 30 days.
hussain.sain 👍 1 Selected: B
B is correct. By setting the topic retention policy to 30 days, any new subscriber will be able to access the data for the past 30 days, regardless of when they connect. This solution is both cost-effective and efficient for your use case.
romain773 👍 1
Option B is wrong i think (topic retention) because it only makes unconsumed messages available for 30 days. I propose option A Option A (creating a new topic and republishing the last 30 days of data for each new subscriber) is actually a better solution to ensure that new subscribers have access to the full 30-day history.
romain773 👍 1
Option B is wrong (topic retention) because it only makes unconsumed messages available for 30 days. Option A (creating a new topic and republishing the last 30 days of data for each new subscriber) is actually a better solution to ensure that new subscribers have access to the full 30-day history.
joao_01 👍 1
Its B. It could be C as well because subscription has message retention. However, in the subscription there is a maximum value for it: 7 days. Link:https://cloud.google.com/pubsub/docs/subscription-properties
Matt_108 👍 2 Selected: B
Definitely B
Sofiia98 👍 4 Selected: B
https://cloud.google.com/blog/products/data-analytics/pubsub-gains-topic-retention-feature
scaenruy 👍 1 Selected: B
B. Set the topic retention policy to 30 days.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

A Pub/Sub topic message retention policy retains published messages for a configurable period (up to 31 days) even if no subscription has consumed or acknowledged them. When a new subscriber is later created, it can seek/replay to read any messages retained on the topic within that window, so a 30-day policy exactly meets the requirement for the yearly sale event. The most-liked comment [1] explains that topic retention keeps messages available for consumption for 30 days regardless of when a subscriber connects. Comment [2] links Google's official blog announcing the topic retention feature, confirming this is the designed use case. It is a pure configuration change, implementable well before the event in two months, with no data movement required.

Why the Other Options Are Wrong

Options A and D require manually republishing or re-pushing 30 days of data every time a new subscriber connects — an operationally fragile, non-scalable anti-pattern that Google exams consistently reject in favor of managed configuration. Option C fails for two reasons: per comment [6] (linking the official subscription-properties documentation), subscription retention has a maximum of 7 days, which cannot cover 30 days; moreover, a subscription retention policy only affects that specific existing subscription, not subscribers created in the future. Comments [4] and [5] argue for A, claiming topic retention only keeps unconsumed messages, but that is precisely the intended behavior — retained messages become readable by new subscribers via seek — and they are outliers against a 100% community vote.

Community Comment Notes

The vote distribution is unanimous (B: 100%), signaling strong consensus. Comment [1] (11 likes) gives the clearest explanation of how topic retention works for new subscribers. Comment [6] contributes the decisive technical detail — the 7-day maximum for subscription retention — which eliminates option C definitively. Comment [2] supplies the official Google blog URL as evidence, while the dissenting comments [4] and [5] misread the retention semantics and should be treated as noise.

Official Reference

Exam Strategy

Whenever a Pub/Sub question involves new subscribers needing access to historical messages, immediately compare topic retention (up to 31 days, covers all future subscribers) against subscription retention (max 7 days, single subscription only). Strongly prefer managed, configuration-only answers over options that require republishing or re-pushing data, as those are almost always distractors on the Professional Data Engineer exam.

Related Analysis

← Back to PDE Study Guide