Create or update a subscription with exactly-once delivery enabled: gcloud pubsub subscriptions create my-sub --topic my-topic --enable-exactly-once-delivery
Use a Pub/Sub client library version that supports exactly-once delivery (v2 Java client or equivalent); the library implements a RetryAckHandler that retracks unacknowledged messages and retries acks on temporary failures
Do not manually set ackDeadlineSeconds on an exactly-once subscription; supported client libraries manage ack deadline extension automatically using minDurationPerAckExtension and maxDurationPerAckExtension on the subscriber
Configure minDurationPerAckExtension if you need to guarantee a minimum processing window: subscriber.setMinDurationPerAckExtension(Duration.ofSeconds(60)) prevents the library from letting the deadline fall below 60 seconds
Verify exactly-once behaviour: confirm that reprocessing a message after a successful ack does not occur by checking subscription/pull_ack_count and subscription/delivery_rate metrics in Cloud Monitoring
Note that exactly-once delivery is per-subscription and only on pull subscriptions; push subscriptions and Cloud Run push integrations do not support exactly-once delivery
Known gotchas
Exactly-once delivery guarantees no redelivery after a successful ack, but does not prevent duplicate delivery before the ack is confirmed — if the subscriber process crashes between receiving and acking a message, the message will be redelivered
Exactly-once delivery has higher per-message latency and cost compared to at-least-once subscriptions due to the additional tracking overhead; benchmark before enabling on high-throughput topics
Mixing exactly-once and at-least-once subscriptions on the same topic is allowed; exactly-once semantics apply only within the individual subscription, not across the topic
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp