Ido Barash
Ido Barash

Reputation: 5122

GCP Pubsub get the delivery attempts of a message on pull

I am receiving data from GCP pub/sub using a pull subscription. I don't get any delivery_attempts field. I saw it here: https://cloud.google.com/pubsub/docs/samples/pubsub-dead-letter-delivery-attempt

Also, when tried to move to ASYNC - I got this field as null.

using latest pyhton SDK: on sync I get this object: pubsub_v1.types.PubsubMessage which has no delivery_attempts.

on Async I get this: pubsub_v1.subscriber.message.Message but with an empty delivery_attempts field.

could it be related to the fact I have no Dead letter policy set? I don't want one and prefer to keep working synchronously.

Any ideas?

Thanks

Upvotes: 0

Views: 462

Answers (1)

Kamal Aboul-Hosn
Kamal Aboul-Hosn

Reputation: 17161

As per the documentation, the delivery attempts field is only populated when a dead-letter topic is set.

When using unary pull, the delivery attempt count is in each ReceivedMessage that comes back in the list in the PullResponse.

Upvotes: 1

Related Questions