Search code examples
publish-subscribegoogle-cloud-pubsub

Google Cloud Pub/Sub ack v nack


I know that message.ack() acknowledges a message, to prevent it being re-sent when the acknowledgement deadline has passed.

But what does message.nack() do? What is the difference between ack and nack?


Solution

  • message.nack() (that is language specific, I know not all languages use that syntax) tells Cloud Pub/Sub that this particular client cannot handle the message. The service can then send the message to another client, potentially after some backoff, where it (hopefully) will be handled successfully.