The transactional outbox: killing the dual-write bug by writing your event in the same transaction as your state

java dev.to

Every event-driven service I've built in the OrderHub series shared one silent flaw, and it took me until now to close it. Since the day placeOrder started publishing events, it did a dual write: save the order to the database, then separately publish OrderPlaced to Kafka. Two systems, no shared transaction — so a crash in the window between them leaves state and events diverged: the order is saved, the event is lost, and nothing downstream ever hears about it. The transactional outbox is the pa

Read Full Tutorial open_in_new
arrow_back Back to Tutorials