A message acknowledgment and a completed business action are separate events. A tutorial must show where each happens and what a failure between them means. Otherwise a clean consumer log can conceal lost work, repeated work, or an unsupported delivery guarantee.
Name the broker, subscription configuration, client behavior, business destination, and the unit of work. Do not use “processed” for receiving a message, updating a record, and acknowledging delivery interchangeably. Give those events separate names in the example.
The lead handoff replay test concerns downstream CRM identity and outreach gates. This guide concerns a message consumer's acknowledgment boundary. Sharing an interest in duplicates does not make those two contracts equivalent.
State the actual delivery model
Google's Pub/Sub subscription documentation describes default at-least-once delivery without ordering guarantees and separately identifies available message-ordering and exactly-once features. It also explains redelivery and the need for idempotent processing under the default model.
Scope any example accordingly. Do not write that Pub/Sub never supports exactly-once delivery, or that enabling a delivery feature automatically makes every external business effect occur exactly once. The source of a delivery guarantee and the destination of a side effect can be different systems.
Record which configuration the lesson uses and which features it excludes. A beginner should not need to discover that an advanced subscription option was silently enabled during the author's demonstration.
Build a local event ledger
Use a harmless synthetic message and a disposable local business record. Give the message an identity, the intended operation an identity where the design supports one, and every observed event a sequence position. The message identifier and business-operation identifier need not be interchangeable in a real system.
| Event | Business state | Delivery observation |
|---|---|---|
| Receive fixture M1 | Unchanged | Message delivered |
| Commit intended operation | One recorded result | No acknowledgment yet |
| Acknowledge through supported client | Still one result | Record actual client result |
| Replay duplicate fixture | Contract-dependent; must be checked | Separate delivery attempt |
The ledger is an invented teaching artifact, not a claim that the broker exposes these exact event labels or provides a transaction across the business destination. Preserve those distinctions when replacing it with platform-specific code.
A timestamp alone may not establish event ordering across machines. For this local exercise, record explicit sequence positions and the relevant observed states instead of inventing precise distributed timing evidence.
Work the two dangerous interruption points
First, stop the disposable fixture after acknowledgment but before the business update. Ask what mechanism, if any, now ensures the missing work occurs. Do not assure readers that redelivery repairs a message their consumer already acknowledged under its actual delivery contract.
Second, stop after the business update but before acknowledgment. A later delivery can repeat the same intended action. The lesson should show how its chosen destination prevents or reconciles duplicates, or state plainly that the example does not implement that protection.
These are controlled failure cases for a local teaching model. They are not instructions to interrupt production consumers. A diagram can specify the expected risks before a maintainer implements a safe supported test.
Define idempotency at the business boundary
Describe what repeating the intended operation should do. For a synthetic catalog import, the same operation might preserve one destination record rather than append another. That requires a specific identity and storage contract; saying “use an idempotency key” does not implement it.
Check the relationship between recording completion and applying the side effect. A separate “seen” flag written too early can suppress unfinished work. A flag written too late can permit repeated work. The tutorial should explain the chosen destination mechanism and its limits rather than implying a universal ordering trick.
Use the acceptance brief to require observable destination state after replay. Counting consumer log lines is insufficient when the claim concerns the number of business effects.
Explain failures without hiding uncertainty
Document the supported retry, acknowledgment deadline, error, and dead-letter behavior only to the extent verified for the chosen configuration. Do not fabricate a retry count or promise that every failed message eventually succeeds. Some failures require intervention or a correction to the input.
Keep an unresolved acknowledgment result distinct from a confirmed business failure. A lost response can leave uncertainty about what happened. The next step should follow the provider and destination contracts, not a blanket instruction to repeat every action.
Keep business payload validation separate from transport handling. A malformed synthetic record may need a documented rejection path rather than endless replay. State whether the demonstration preserves it for diagnosis, records a terminal failure, or uses another supported mechanism. Do not acknowledge and discard it silently while claiming every intended business action succeeded. Counting terminal outcomes should expose rejected work as well as completed work.
Show the difference between a duplicate delivery and a duplicate business effect in the final transcript. A system can tolerate repeated deliveries while preserving the desired result. Conversely, one visible delivery can trigger several downstream writes if the example itself repeats them.
Release the failure cases with the happy path
The final packet should include the named delivery configuration, event ledger, positive result, interrupted cases, replay behavior, and unresolved limitations. A reader should be able to trace exactly which observation supports each completion claim.
The verification worksheet separates broker facts from your original processing design. Recheck when client libraries, destination transaction rules, or subscription settings change; the same prose can become wrong even if the message payload stays identical.
Approve when the guide explains what acknowledgment means, where business completion occurs, and how the example behaves when those events do not happen together. That is a more useful teaching result than labeling an uninterrupted demo reliable.
