How I Shipped a Java Library to Maven Central, Solo
Description and use
oncebox is a Java library that guarantees atomicity between database writes and message broker publishes without two‑phase commit or CDC. The author developed, tested, and shipped it solo to Maven Central with signed releases and extensive tests.
Problem
Ensuring atomicity between database writes and message broker publishes without heavyweight solutions like two-phase commit or CDC pipelines.
Outcome
oncebox was shipped solo to Maven Central, achieving atomic dual-write guarantees across multiple databases and brokers, with signed releases, extensive testing, and production-ready tooling.
Workflow
- 1. Call publish() or annotate a method with @OutboxPublish inside a @Transactional method. 2. Event is written to an outbox table in the same transaction. 3. A poller selects pending events using SELECT … FOR UPDATE SKIP LOCKED. 4. Poller publishes events to Kafka or RabbitMQ with exponential backoff. 5. Failed events are retried; exhausted events move to a dead‑letter queue (DLQ) in a single transaction. 6. DLQ exposes a REST API for inspection and replay. 7. Inbox deduplicates on event ID to prevent double processing.
Evidence
oncebox guarantees a database write and a message-broker publish either both happen or neither does, with no two-phase commit and no CDC tooling watching the binlog.
The event is written to an outbox table in that same transaction, and a poller picks it up and publishes it to Kafka or RabbitMQ, retrying with backoff.
v2.0.0 is a breaking release. The structure is now named by mechanism, outbox and inbox, rather than by the role of the service.
346 of the 602 Java files in the repo are test sources, split across tiers that each catch a different kind of failure.
Oncebox is Apache 2.0, on Maven Central as io.github.dmitriy-iliyov:oncebox-*, and the source is at github.com/dmitriy-iliyov/oncebox.
- Record date: 2026-10-15T02:41:08.308Z