How I Shipped a Java Library to Maven Central, Solo
The dual-write problem shows up wherever a service needs to update its database and notify the outside world as one atomic step. The write succeeds and the publish fails, or the reverse, and two systems that were supposed to agree quietly stop agreeing. The usual fixes are heavyweight: two-phase commit, or a CDC pipeline like Debezium reading the database's transaction log. I built oncebox to…
Maven Central, the central repository for Java libraries, received its first contribution from a single person on October 11, 2025. The library, named oncebox, tackles the dual-write problem - ensuring database updates and message-broker notifications occur together. The creator built the solution from scratch, without relying on heavyweight approaches like two-phase commit or CDC pipelines.
oncebox works by writing events to an outbox table within the same transaction as the business write. A separate poller then safely publishes these events to Kafka or RabbitMQ, with exponential backoff if the broker fails. The failed events are retried and managed through a dead letter queue with its own REST API for inspection.
Developed by one person, oncebox consists of 13 Maven modules and 602 Java files, half of which are tests. The library supports PostgreSQL, MySQL, and Oracle databases, with Kafka and RabbitMQ as message brokers. After a year of solo development, the library has gone through five releases, v1.0.0 to v2.0.0.
Shipping the library involved more than just writing code. The creator had to handle GPG signing for verifiable releases, set up Sonatype/Central publishing flow, generate usable documentation, and configure various monitoring and testing tools. The outbox and inbox configurations are split into different sections for flexibility, and Grafana dashboards and a Postman collection provide easy access to the dead letter queue API.
The key to oncebox's design lies in its polling mechanism, which allows multiple instances to poll the same outbox table without blocking each other. The library also handles database-specific quirks, such as MySQL's gap locks under READ COMMITTED isolation level and Oracle's limitations on batch size.
The creator's focus on comprehensive testing, including unit, integration, concurrent, end-to-end, and load tests, ensured the library's reliability even without a second set of eyes. This level of testing, combined with the library's robust design, has resulted in a Maven Central release that other services can depend on confidently.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.