diff --git a/products/pubsub/api.yaml b/products/pubsub/api.yaml index cb07dc42a139..d6e512f73eb2 100644 --- a/products/pubsub/api.yaml +++ b/products/pubsub/api.yaml @@ -144,3 +144,23 @@ objects: If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message. + - !ruby/object:Api::Type::String + name: 'messageRetentionDuration' + default_value: '604800s' + description: | + How long to retain unacknowledged messages in the subscription's + backlog, from the moment a message is published. If + retainAckedMessages is true, then this also configures the retention + of acknowledged messages, and thus configures how far back in time a + subscriptions.seek can be done. Defaults to 7 days. Cannot be more + than 7 days (`"604800s"`) or less than 10 minutes (`"600s"`). + + A duration in seconds with up to nine fractional digits, terminated + by 's'. Example: `"600.5s"`. + - !ruby/object:Api::Type::Boolean + name: 'retainAckedMessages' + description: | + Indicates whether to retain acknowledged messages. If `true`, then + messages are not expunged from the subscription's backlog, even if + they are acknowledged, until they fall out of the + messageRetentionDuration window. diff --git a/templates/terraform/examples/pubsub_subscription_pull.tf.erb b/templates/terraform/examples/pubsub_subscription_pull.tf.erb index d47fb9fa403a..91c1b38fbb6a 100644 --- a/templates/terraform/examples/pubsub_subscription_pull.tf.erb +++ b/templates/terraform/examples/pubsub_subscription_pull.tf.erb @@ -10,5 +10,9 @@ resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { foo = "bar" } + # 20 minutes + message_retention_duration = "1200s" + retain_acked_messages = true + ack_deadline_seconds = 20 }