Skip to content

refactor(eventbus): extract shared outbox dispatcher behind a store port - #221

Merged
tiana-code merged 1 commit into
mainfrom
feat/E-02-payments-outbox-extract
Jun 18, 2026
Merged

refactor(eventbus): extract shared outbox dispatcher behind a store port#221
tiana-code merged 1 commit into
mainfrom
feat/E-02-payments-outbox-extract

Conversation

@tiana-code

Copy link
Copy Markdown
Owner

What

Third slice of E-02. Behaviour-preserving refactor that extracts the transactional-outbox dispatch pipeline from services/ledger into libs/fincore-eventbus (com.fincore.eventbus.outbox) behind an OutboxStore port, so the payments service (#211) can relay its own outbox through the same dispatcher instead of copying it (the #195 hazard).

  • New in libs: OutboxStore port (claim/markPublished/markFailed), ClaimedEvent/DispatchSummary, OutboxDispatchSettings (defaults equal to the old ledger properties), OutboxDispatcher (moved verbatim, parameterized by the port + settings).
  • Ledger: OutboxClaimStore now implements OutboxStore (bodies unchanged, @Component/@Transactional intact so the publish-outside-transaction boundary is preserved); OutboxDispatchConfig wires the shared dispatcher, mapping every field from OutboxDispatcherProperties; the ledger-local dispatcher and claimed-event types are deleted.
  • Tests: the two pure dispatcher unit tests move to libs (mock the port); the config bean-wiring test stays in the ledger; the ledger dispatcher integration tests are the behaviour-preservation proof.

Cleanup and metrics stay ledger-local (cleanup is multi-table, service-specific); the write-side publisher interface is deferred to #211 where it gains a second real consumer.

Gates

Local (-x integrationTest): :libs:fincore-eventbus:{test,detekt,spotlessCheck,assemble} + :services:ledger:{test,detekt,detektTest,spotlessCheck,assemble,compileIntegrationTestKotlin} green. critic GO, security-auditor PASS (INV-1 publish-outside-tx + INV-2 lease/at-least-once preserved, verified by byte-diff), evaluator 0.91. The ledger dispatcher ITs run on CI and prove no behaviour change.

Closes #210

Move the transactional-outbox dispatch pipeline (the dispatcher, the claimed
event and dispatch summary types, and the dispatch settings) out of the ledger
service into libs/fincore-eventbus behind a new OutboxStore port. The ledger
OutboxClaimStore now implements that port with its transaction boundary
unchanged, and the ledger wires the shared dispatcher from its own properties.
This lets a second service relay its own outbox through the same dispatcher
instead of copying it. Behaviour is unchanged: the dispatcher body, the topic
and key formulas, the lease and retry logic, and the publish-outside-transaction
boundary are preserved, and the existing ledger dispatcher integration tests
cover it.

Closes #210
@tiana-code tiana-code added this to the v0.2.0 milestone Jun 18, 2026
@tiana-code
tiana-code merged commit 689dce9 into main Jun 18, 2026
8 checks passed
@tiana-code
tiana-code deleted the feat/E-02-payments-outbox-extract branch June 18, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F-02.3 Extract shared outbox dispatcher and cleanup into libs/fincore-eventbus

1 participant