Exactly-once semantics: at-most-once / at-least-once / exactly-once. Three tiers of delivery semantics. Effective EOS = at-least-once delivery + idempotent consumer + atomic commit. Kafka transactional API (transactional.id, sendOffsetsToTransaction, isolation.level=read_committed, transaction coordinator with __transaction_state). Flink TwoPhaseCommitSinkFunction with pre-commit on checkpoint barrier and commit on notifyCheckpointComplete. Idempotent consumer with Redis dedup. Two Generals myth: exactly-once delivery невозможен, но exactly-once effects реален. ADRs: when EOS critical vs at-least-once + idempotency enough; effective EOS = three ingredients (delivery + dedup + atomic commit). Scenarios: at-least-once duplicate (double billing), Kafka EOS happy path, idempotent producer retry, transaction abort, Flink 2PC commit on checkpoint, Flink failure recovery, idempotent consumer dedup, EOS impossible without sink cooperation.
Exactly once — не свойство сообщения в вакууме. Это proof, что один logical input создаёт один logical effect в конкретной системе/transaction boundary несмотря на retries and crashes.
| Компонент | Ответственность |
|---|---|
| Replayable Input Log | Хранит input offsets and supports replay. |
| Transactional Processor | Связывает input identity, state and supported outputs. |
| Kafka Transaction Output | Может атомарно принять output records и input offset in Kafka. |
| Durable Intent and Outbox DB | Уникально хранит operation key/fingerprint/state/result. |
| External Side-Effect Provider | Отдельная failure domain; участвует только если поддерживает idempotency/status lookup. |
| Unknown-Outcome Reconciler | Разрешает ambiguous outcome по тому же operation key. |
| Bounded Dedup State | Хранит identities дольше максимального replay/retry horizon. |
A transactional producer writes output records and the consumed offsets in one Kafka transaction. read_committed consumers hide aborted outputs.
Проверяемый исход: Exactly-once is claimed only for the Kafka input/output transaction and correctly handled rebalances/errors.
A domain change and outbox intent commit in one database transaction. Relay delivery may duplicate, so the consumer remains idempotent.
Проверяемый исход: No dual-write gap exists between local domain state and publication intent.
Intent is durable before calling the provider. A timeout can mean success; state becomes UNKNOWN and no blind second charge is issued.
Проверяемый исход: Reconciliation queries by the same provider idempotency key and finalizes one stable result.
A replay older than dedup state can create a second logical effect. TTL must exceed the maximum source replay, client retry and disaster recovery horizon or an authoritative permanent key must exist.
Проверяемый исход: Expired state fails closed or reconciles against durable domain identity; invalid Redis command folklore is removed.
Числа выше — учебные inputs или размерностные формулы. Их нельзя выдавать за benchmark или SLA конкретного продукта.
Диаграмма показывает причинные границы и recovery contracts, а не скрытую реализацию конкретного managed-сервиса. Любая stronger guarantee действует только в явно названной transaction/checkpoint/acknowledgement boundary.
Введите числа или выберите пресет