Rodrigo
Rodrigo

Reputation: 391

Google PubSub decrease attempts to delivery a message by push

I have a Cloud Run service that subscribes to a PubSub topic using HTTP Push.

When my service returns HTTP 400, PubSub keeps trying forever. How can I decrease the delivery attempts and add a time between each attempt?

Upvotes: 0

Views: 150

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75930

On your PubSub subscription, you can use 2 features:

  • Dead Letter Topic
  • Retry policy

enter image description here

Dead letter topic, after a number of tries (mini 5 tries), ack the message publish it in another topic. Like that, after a certain number of tries, the message is no longer pushed to your app.

You can choose to listen, or not, the dead letter topic. By default, if there isn't subscription on the dead letter topic, the messages are deleted.

The retry policy add exponential backoff between each tries.

Upvotes: 2

Related Questions