Our billing service creates an invoice in PostgreSQL and publishes InvoiceIssued to Kafka so that the email, ledger and analytics services can react. For months the code did exactly that, in that order, and it worked in every test we wrote. Then a node drain killed a pod between the database commit and the Kafka send. Forty-one invoices existed in billing but no customer ever received them, and the ledger never booked the receivables. Nobody noticed for nine days. This is the dual-write problem:...
Transactional outbox: keeping the database and Kafka consistent without dual writes
Saving a row and then publishing to Kafka looks harmless until the process dies between the two. We walk through the dual-write bug we shipped, a working outbox with a polling relay you can run locally, the Debezium variant, and how sagas build on it across services.
This is a paid story
Subscribe to read the full content, access all paid stories, and support the authors.
Add a label
Embed this post
<iframe src="https://www.hibug.me/transactional-outbox-kafka-database-consistency" width="700" height="420" frameborder="0" loading="lazy"></iframe>
I am a Senior Software Engineer with over a decade of hands-on experience building, scaling, and maintaining complex systems across the full stack—spanning frontend, backend, and DevOps. Over the last 10 years, I have navigated diverse architectures and untangled some of the most frustrating, elusive bugs in production. I believe that every production incident is a massive learning opportunity. Having discovered hibug.me, I am excited to contribute to this knowledge base, breaking down root causes, and sharing verified fixes to help fellow developers debug faster and build more resilient systems.
Related Stories
Kafka consumer crashed before committing offsets and replayed stock movements twice
Real-time analytics with Flink and Apache Doris: from Kafka events to sub-second queries
Comments
0No comments yet. Be the first to comment!
Sign In to post a comment.