Any method to clear messages at a time?

3,723 views
Skip to first unread message

Santosh Ashtaputra

unread,
Sep 16, 2017, 8:48:56 AM9/16/17
to Google Cloud Pub/Sub Discussions
Hi,

Is there any method/procedure available to clear messages from a subscriber ?


Sometimes there will be more than 500 messages in the subscriber, I pull the messages, I will not get desired result(my functional error) so I want to clear all messages at once and start my testing again. The only way I clear is "pulling messages --> get ackid --> ack the message" (in loop using python script).

But I wait 600 seconds for ack deadline and later I will clear the messages. 

Is there any other method available where I don't need to wait for 600 secs?


Thanks,
Santosh


Kenworth (Google Cloud Platform)

unread,
Sep 17, 2017, 3:23:20 PM9/17/17
to Google Cloud Pub/Sub Discussions
You can delete a subscription and create a new one with the same name. All messages retained in the old subscription are immediately dropped. The new subscription has no relation with the old one even though they have the same name. Therefore, the new subscription has no backlog at the time it is created (no messages waiting for delivery), even if the deleted subscription had a large number of unacknowledged messages. You can read more about the API on deleting subscriptions here.


Reply all
Reply to author
Forward
0 new messages