Is there a way to set the retention period for google cloud pub / sub?

Is there a way to specify the retention period of messages in the Google / sub cloud pub? Let's say I have a subscriber who started spending messages, but the service crashed and reappeared a day after fixing the error. Can he continue to work from the last checkpoint? How soon should the consumer reconnect to the pub / sub to ensure that he does not lose any messages?

Similarly, Amazon Kinesis can store messages for up to 24 hours, and Kafka can have a storage policy based on time and / or disk space.

+5
source share
2 answers

Subscriptions can save undelivered messages for up to 7 days. It is not configurable.

FYI describes various limits, including this one: https://cloud.google.com/pubsub/quotas

+1
source

Google Cloud PubSub subscriptions can now be created with a duration of storage of user messages using the alpha API and gcloud CLI, for example:

# gcloud alpha pubsub subscriptions create mysub --topic=mytopic --message-retention-duration=48h 

Accepted values ​​are from 10 minutes to 7 days (default).

For reference: https://cloud.google.com/sdk/gcloud/reference/alpha/pubsub/subscriptions/create

The subscription update is still in private alpha: https://cloud.google.com/sdk/gcloud/reference/alpha/pubsub/subscriptions/update

+2
source

All Articles