Skip to content

Transactional outbox — Phase 1: domain_event log + transactional publish#94

Open
luksow wants to merge 4 commits into
mainfrom
outbox-phase-1
Open

Transactional outbox — Phase 1: domain_event log + transactional publish#94
luksow wants to merge 4 commits into
mainfrom
outbox-phase-1

Conversation

@luksow

@luksow luksow commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Producer-side infrastructure for a transactional outbox (Phase 1 of 2; delivery/consumers come in Phase 2).

What's here

  • V6__domain_event.sql — append-only domain_event log (plain table; (event_type, id) and (aggregate_type, aggregate_id) indexes).
  • DomainEvent envelope + opaque DomainEventId (UUIDv7).
  • OutboxRepositoryappend: DBInTransaction[Unit] (events written only inside a transaction) and findByAggregate (audit read).
  • DomainEventDescriptor[A] typeclass (versioned event_type, aggregate identity, jsonb encoding).
  • DomainEvents.publishTransactionally[A] — stamps a UUIDv7 id + occurred_at and appends in the caller's transaction.

Not in scope (Phase 2)

Delivery ledger, dispatcher, subscribe/consumers, scheduler dead-letter, backfill, DI wiring, and the account-deletion worked example.

Tests

Testcontainers + Flyway: jsonb round-trip, publish writes the versioned event with a UUIDv7 id, and atomicity (a failing surrounding transaction persists no event).

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.

1 participant