At‑least‑once(the default)Exactly‑once
At‑least‑once delivery (default)
At‑least‑once is Pub/Sub’s default delivery guarantee: every published message will be delivered to subscribers at least once, so messages are never silently lost. However, individual messages can be delivered multiple times.
Duplicates most often arise when:
- A subscriber delays an acknowledgement
- The ack deadline expires before processing completes
- Network retries or transient errors cause redelivery

- Use a stable, application-level message identifier so repeated IDs can be detected and ignored.
- Implement idempotent processing: handling the same message multiple times should result in the same state as handling it once.
- Add a deduplication layer (in memory, in a database, or in an external service) when absolute uniqueness is required.

- Logging and metrics ingestion where occasional duplicates are acceptable.
- Telemetry and analytics event collection where completeness is more important than perfect uniqueness.
- Any pipeline where losing messages is unacceptable but downstream systems can handle or deduplicate repeats.
When asked about Cloud Pub/Sub’s default delivery mode, the correct answer is at‑least‑once delivery.
Exactly‑once delivery
Exactly‑once aims to ensure each published message is delivered and processed exactly one time. Implementing exactly‑once semantics usually combines:
- Precise acknowledgement and checkpointing,
- Idempotency or deduplication in the subscriber or downstream systems,
- Integrations with tools that support deduplication (for example, Cloud Dataflow).
Exactly‑once reduces duplicates but requires careful operational controls. If processing fails after acknowledging a message, recovery can be difficult—plan for auditing, retries, or replay mechanisms outside Pub/Sub.

- Financial transactions and billing systems (to avoid double charges).
- Stateful workflows or counters where duplicate events would corrupt state.
- Mission-critical reconciliation processes requiring strict uniqueness guarantees.

Quick comparison
| Guarantee | Delivery behavior | Duplicates | Typical use cases | Complexity / Cost |
|---|---|---|---|---|
At‑least‑once | Messages are delivered ≥1 times; Pub/Sub retries until acknowledged | Possible | Logging, telemetry, analytics ingestion | Low to medium |
Exactly‑once | Guarantees single effective processing (with deduplication/ack tracking) | Eliminated (if implemented correctly) | Billing, financial transactions, stateful workflows | High |
Summary
- At‑least‑once is Pub/Sub’s default: it prevents message loss but permits duplicate deliveries. Build subscribers to tolerate or remove duplicates.
- Exactly‑once removes duplicates when you implement acknowledgement tracking and deduplication, but it raises complexity and operational cost. Use it only for workloads where duplicates are unacceptable.