Avoid an unreliable database-plus-broker dual write#
If the order commits but event publication fails, downstream consumers never hear about it. If publication happens first and the transaction fails, consumers observe an order that does not exist.
Business state and publication intent commit atomically in one database. The relay can poll or use CDC. If it publishes and crashes before recording progress, it may publish again, so consumers remain duplicate-safe.
- Claiming the outbox gives global exactly-once effects.
- Deleting outbox rows before broker acceptance.
- Ignoring relay lag, cleanup, and partition ordering.
Related practice problems
Use the manifest-backed prompts below to apply this lesson in a complete design.
- Kafka design and delivery semanticsApache Kafka Documentation