I have a subscription in Google Pub/Sub where messages can be either acknowledged (acked) or not acknowledged (nacked). To handle the at-least-once delivery guarantee of Pub/Sub, I use an idempotent store to deduplicate messages that are delivered multiple times.
Currently, I nack duplicate messages. However, I'm curious: if I process a message that was previously in progress and then successfully ack it, will this acknowledgment also apply to the duplicate messages that I had nacked earlier?
I haven't found any related documentation. Any clarification on this behavior would be greatly appreciated.
Duplicate messages should be acked, not nacked. There is no guarantee that acking one instance of a message's delivery will result in the acknowledgement of all deliveries and could result in continued redeliveries of the message. If you receive duplicates while you are still processing a message, it is best to keep track of the deliveries and acknowledge them all once processing is complete.