Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I Shipped a Java Library to Maven Central, Solo

说明与用途

oncebox 是一款 Java 库,保证数据库写入和消息代理发布的原子性,无需两阶段提交或 CDC。作者独立开发、测试并将其发布到 Maven Central,提供签名发布和全面测试。

问题

Ensuring atomicity between database writes and message broker publishes without heavyweight solutions like two-phase commit or CDC pipelines.

结果

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.

工作流

  • 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.

证据

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.

来源

  • 记录日期: 2026-10-15T02:41:08.308Z