Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to Trigger a Retry in PubSub When Using Push Subscriptions

I have a google cloud function that is subscribed to a pubsub push-type subscription. Because of the setup, the function does not use http requests to receive or respond to the subscription.

What I am trying to do is trigger a retry for a message for when there is an error in my function (e.g. api limit is hit), so that I can utilize the retry functionality of pubsub to use exponential backoff to keep trying.

I have implement try catch blocks in my function and throwing errors accordingly to try to trigger a retry, but none of the messages are ever retried.

Am I missunderstanding how PubSub works with these retries? Do I need to handle retries in the function's code instead? I am somewhat new to GCP and software development, so I would appreciate any advice.

0 1 717
1 REPLY 1