ledger-flow

A transaction ledger that never charges twice.

An event-driven transaction ledger in Java 21, Spring Boot and Kafka, built to demonstrate a tested transactional outbox, idempotency keys and a deduplicating consumer.

ledger-api accepts POST /transactions with a required Idempotency-Key, writes the ledger row and an outbox row in one PostgreSQL transaction, and a relay publishes to Kafka once the broker acknowledges. ledger-notifier consumes the events, deduplicates on event id and projects the status into its own database.

The guarantees are proven by integration tests on real containers that inject failures — outbox atomicity, idempotent replay, broker outage, consumer deduplication. A Docker Compose stack runs both databases, Redpanda, the services, Prometheus and Grafana, with a correlation id traced across services. Decisions are recorded as ADRs.

Built

Technology

Java 21, Spring Boot, Apache Kafka, PostgreSQL, Flyway, Testcontainers, Prometheus, Grafana, Docker Compose

The ledger-flow test run in a terminal: unit tests, then integration tests on real PostgreSQL and Kafka containers — outbox atomicity, broker outage, idempotency keys, consumer deduplication — and BUILD SUCCESS

Index