john mich
john mich

Reputation: 2873

Is there a way to delete a message from pubsub message store?

I am using GCP Pubsub to send and receive JSON data, Pubsub has a feature to retain a message from a time period of 10 minutes up to 7 days and not less than 10 minutes (according to the official documentation). Is there any way to delete a pulled message from Pubsub? If not, then why do we say that Pubsub is a "Queuing technique" when we willingly cannot delete a message from a message store which violates a basic queue property?

I am using python Pubsub client library for the scripting purpose.

Upvotes: 9

Views: 21875

Answers (2)

Max
Max

Reputation: 1175

If needed, you can also perform a purge inside the subscriber section and that will acknowledge all of the message currently waiting inside the store for that specific subscriber.

Go to subscriptions -> specific subscriber -> purge messages

Upvotes: 19

Kamal Aboul-Hosn
Kamal Aboul-Hosn

Reputation: 17271

Messages are retained by Google Cloud Pub/Sub under two conditions:

  1. The message has not yet been acknowledged for a subscription and the retention duration has not passed.
  2. retainAckedMessages is enabled and the retention duration has not passed.

Once you have received a message and called ack on it within the ack deadline, the message will no longer be redelivered for that subscription (other than duplicates that can happen given that Pub/Sub has at-least-once delivery semantics).

Upvotes: 7

Related Questions