Menu

1 / 9

Transactional Outbox and Inbox in Spring Boot

DEV Community: java·sayner·11 days ago
#UbRGOalR
#devtojava#devto#dev#result#event
Reading 0:00
15s threshold

A polling-based transactional outbox and inbox for Spring Boot, taken apart: how events leave the database, why the polling delay adapts, why each event type gets its own settings, and the three clocks that decide how long a duplicate is remembered.

The write that has two destinations

I wrote a transactional outbox for two of my own projects. The existing options did not fit, and log-based CDC with Debezium felt too heavy for a simple requirement: save an event together with the data, and send it later. oncebox is what that outbox grew into.

The requirement exists because a service that changes its database and then publishes a message is writing to two systems, and a database transaction covers only one of them. If the process dies between the commit and the publish, the data has changed and nobody was told. Reverse the order and a message goes out for a change that never happened.

The outbox pattern closes the gap by making the event part of the transaction.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.