Offsets & Exactly-Once Semantics

Where you commit decides what gets replayed after a crash.

0/3 done

Commit after, not before

Commit after the side effect

Offsets are the consumer's bookmark. Two anti-patterns kill EOS:

  • enable.auto.commit=true — offsets advance every 5s in the background, before your handler returns. A crash mid-handle replays nothing and you lose data.
  • Committing before writing downstream — guarantees duplicates on retry.

Rule: enable.auto.commit=false, then commitSync() (or transactional sendOffsetsToTransaction) after the side-effect succeeds.

Manual commit after side-effect (Python)

Show the correct shape: poll → handle → commit. No auto-commit.

Reflect

Pick the consumer in your stack closest to a payments side-effect.

  • Is auto-commit on? If yes — what's the worst record you could double-process today?
  • Where would you put `commitSync()` to make the handler exactly-once-per-effect?

Reading in progress · 0 of 3 activities done