We are using Google PubSub for an IoT project in a multi-tenant system
The problem we are having is: when we un-plug a device for a couple of days, and then re-plug it, it starts to receive hundreds of messages (old heartbeats from the other devices) that make the device slow for a few minutes.
The question is:
What do you think is the correct way to work with this?
We are open to recommendations.
Thank you!!!
In Google Cloud Pub/Sub, messages will be retained for subscriptions for 7 days. Therefore, if your device reconnects, it will receive up to 7 days worth of messages.
To skip older messages, one can use seek on a Pub/Sub subscription (currently in alpha) to ack older messages by seeking to a timestamp corresponding to now. The devices could each call this API when they start up before they start to subscribe as a means to clear out the older messages.
Regarding your setup in general, how many tenants and devices do you have? Keep in mind the quotas: a single project can only have 10,000 topics and 10,000 subscriptions.