Create a pull subscription with exactly-once delivery enabled: gcloud pubsub subscriptions create my-sub --topic my-topic --enable-exactly-once-delivery
Note that exactly-once delivery is only supported on pull and StreamingPull subscriptions; push and export subscriptions do not support this feature
The default ack deadline for exactly-once subscriptions is 60 seconds (higher than the standard default); extend it via ModifyAckDeadline if processing takes longer, up to a maximum of 600 seconds
Use the high-level client library's subscriber which manages lease extension automatically; on acknowledgment failure (non-OK status), expect redelivery and ensure your handler is idempotent
With message ordering enabled on the subscription, acknowledge messages in order; out-of-order acks on an ordering-key group will be rejected with a temporary error and the client must retry
Monitor subscription/oldest_unacked_message_age metric in Cloud Monitoring to detect processing backlogs before they cause ack deadline expirations
Known gotchas
Exactly-once delivery guarantees that a successful ack will not result in redelivery, but it does not prevent duplicate processing if your consumer crashes after processing and before acking; combine with an idempotent consumer for end-to-end exactly-once semantics
Exactly-once subscriptions have higher internal coordination overhead; throughput per subscription is lower than at-least-once subscriptions — benchmark before choosing for high-volume topics
Enabling exactly-once delivery cannot be done on an existing subscription; you must create a new subscription with the flag set
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