是否可以在 pubsub 的同步拉取中取消确认消息

Is it possible to unacknowledge messages in synchronous pull for pubsub

我正在通过订阅拉取 pubsub 消息,并且需要在处理之前确认这些消息,因为我正在进行多处理,并且由于 grpc 模块而引发 SSL 损坏错误。

我想预先确认所有消息并取消确认以防出现错误,我知道我们可以为异步拉取执行此操作,但是有没有一种方法可以在同步拉取中实现取消确认?

我正在使用官方 python 模块从订阅中提取

我想 unack 你的意思是 nack explained in Python API 参考:

In Pub/Sub, the term ack stands for “acknowledge”.

...

It is also possible to nack a message, which is the opposite...

同一文档包含部分 同步拉取订阅 其中解释了如何 nackmodify_ack_deadline():

If you want to nack some of the received messages (...), you can use the modify_ack_deadline() method and set their acknowledge deadlines to zero. This will cause them to be dropped by this client and the backend will try to re-deliver them.