Skip to content

Feat: outbox events#2

Open
misterquestions wants to merge 5 commits intomainfrom
feat/outbox-events
Open

Feat: outbox events#2
misterquestions wants to merge 5 commits intomainfrom
feat/outbox-events

Conversation

@misterquestions
Copy link
Copy Markdown
Owner

[Unreleased]

Added

  • Transactional outbox implementation (entity, repository, relay with exponential backoff & retry)
  • Event envelope (eventId, type, version, occurredAt, aggregateType, aggregateId, traceId, data)
  • Micrometer metrics for outbox: orders.outbox.pending, orders.outbox.failed, orders.outbox.backlog.oldest_age_seconds, orders.outbox.relay.batch.duration, orders.outbox.publish.attempt{status}
  • Health indicator (DEGRADED on failed rows) surfaced via /actuator/health
  • Admin endpoints: POST /api/v1/outbox/requeue-failed, POST /api/v1/outbox/{id}/requeue
  • Comprehensive test suite (relay success, retry -> success, forced failure -> FAILED, schema validation, optimistic locking, validation errors, requeue endpoint)
  • JSON Schema validation tests for order.created.v1 & order.cancelled.v1
  • Awaitility-based polling in async integration tests
  • README enhancements (event envelope example, metrics, health, admin endpoints, CI badge)
  • OpenAPI spec updates (outbox endpoints, quantity field normalization)
  • Flyway migration V2__outbox.sql (if Flyway enabled) for outbox table

Changed

  • Removed afterCommit direct Kafka publishing in favor of transactional outbox persistence
  • Simplified EventPublisher (single-attempt publish)
  • Refactored event payload classes to domain-only (moved type/version to envelope)
  • Improved domain model with @Version and lifecycle timestamp callbacks

Fixed / Hardening

  • Increased reliability & visibility for event publishing failures
  • Added validation & optimistic locking test coverage

Security / Observability

  • Structured logging for publish failures (attempt, status)
  • Outbox backlog and failure counts exposed via metrics & health

Deprecated

  • (None)

Removed

  • Legacy afterCommit event publishing logic

Breaking Changes

  • Event JSON shape changed (type/version now at envelope root; legacy consumers may need adaptation)

@misterquestions misterquestions self-assigned this Sep 9, 2025
@misterquestions misterquestions added the enhancement New feature or request label Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant