Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Is there a way to specify the retention period for the messages in google cloud pub/sub? Let's say I have a subscriber started consuming messages, but the service crashed and is back online a day later after the bug is fixed. Can it continue from the last checkpoint? How soon the consumer needs to reconnect with the pub/sub to guarantee that it won't lose any messages?

On a similar note, the Amazon Kinesis can keep messages up to 24 hours, and Kafka can have retention policy based on time or/and disk space.

like image 873
user1192699 Avatar asked Jun 08 '15 16:06

user1192699


People also ask

Is Pub sub persistence?

No - Redis' Pub/Sub has no persistence, and once a message has been published, it is sent only to the connected subscribed clients. Afterwards, the message is gone forever.

What is retention period in GCP?

You can set a maximum retention period of 3,155,760,000 seconds (100 years).

Can cloud pub/sub hold millions of messages?

There is no limit on the number of retained messages. If subscribers don't use a subscription, the subscription expires.

How do I pause Pubsub subscription?

To pause receiving messages for a subscription, send a modifyPushConfigRequest to set the push endpoint to an empty string. The messages will accumulate, but will not be delivered. To resume receiving messages, send another modifyPushConfigRequest request with a populated push endpoint.


2 Answers

Google Cloud PubSub Subscriptions can now be created with a custom message retention duration using the beta API and gcloud CLI, e.g.:

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

Accepted values are between 10 minutes to 7 days (the default).

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

Subscriptions can now also be updated (beta): https://cloud.google.com/sdk/gcloud/reference/beta/pubsub/subscriptions/update

like image 89
Patrick Decat Avatar answered Oct 16 '22 07:10

Patrick Decat


Subscriptions can retain undelivered messages for up to 7 days. It's not configurable.

FYI various limits including this one are described here: https://cloud.google.com/pubsub/quotas

like image 25
Takashi Matsuo Avatar answered Oct 16 '22 07:10

Takashi Matsuo