Kiran
Kiran

Reputation: 1

Cloud Functions with Cloud pubsub trigger queuing the messages

We have a Cloud Functions with a Pubsub trigger and it will invoke an application on HTTP endpoint based on the message. When we need to update the backend application we want the Cloud Functions to pause and queue up the messages and then start again when the application is up.

Currently we are logging all the failed messages in Stackdriver and resubmitting them after the release. Is there any better way to do this?

Upvotes: 0

Views: 222

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75715

Your system must be resilient to outage (managed by you when you perform an update, or unexpected). Therefore, I recommend you to handle both in the same way.

Set the retry parameter when you deploy your Cloud Functions (background functions, bind with PubSub topic). When your Cloud Functions can't process the message (the application isn't available), raise an error. The message will be retried later.

Like that, you have nothing to worry. When the message can be delivered, it is, and when it can't, there is an error and the message is retried.

Upvotes: 1

Related Questions