google-cloud-pubsub

Does updating message retention duration in GCP pubsub act retroactively?


The documentation does not clearly specify if this change (from currently 7 days to 31 days) is enforced retroactively. More specifically, this part:

Configuring a subscription to retain acknowledged messages (using the retain_acked_messages property) lets you replay previously-acked messages retained by the subscription. You can configure messages to be retained for a maximum of 31 days in a subscription. This configuration applies to both acknowledged and unacknowledged messages.

Does This configuration applies to both acknowledged and unacknowledged messages mean only for new messages or old and new?

edit: If it wasn't clear we currently enforce a 7 day retention, and want to update to 31, and wonder how this will affect existing acked and unacked messages


Solution

  • If the message_retention_duration property for a subscription is updated, the change will be retroactively applied to previously published messages. Thus, if the message_retention_duration is updated from 7 days to 31 days, messages from before that update occurred will now be retained for 31 days, as long as those messages were not already expired before the update. This applies to both unacknowledged and acknowledged (i.e., retain_acked_messages==true) messages.