No1Lives4Ever
No1Lives4Ever

Reputation: 6883

Google Pubsub - Get dequeue count information

I using Google Pub-Sub service with 1 subscriber and 1 publisher. The code is written with C#. The publisher inserting messages to the "queue" and the subscriber running the background code to handle it.

From time to time I found that my code has a bug that leading me to retry the same message again and again. The problem is that the result is the same for those cases - crash.

My idea to have an attribute of "dequeue-count" that counter how many producers already tried to solve this specific task. If this number is bigger then 3 - drop this message.

Is this possible to get the dequeue count without implementing it manually? (manually = store the message ID in crashes database).

Upvotes: 0

Views: 322

Answers (2)

JasonCoder
JasonCoder

Reputation: 1136

Google pub-sub service now has a dead letter queue feature that can help alleviate this situation. Muuuuuch better than having to track it yourself.

Upvotes: 2

Jason Ganetsky
Jason Ganetsky

Reputation: 421

No, Cloud Pub/Sub does not provide a count of the number of times any given message was delivered. You will need to count it yourself.

Upvotes: 0

Related Questions