Round 01 / 05 · Circuit Partition
Kafka Payment Processing System
- Java
- Spring Boot
- Apache Kafka
- PostgreSQL
- Docker
Sector 1
Objective
Process payments as events so producers and consumers scale and fail independently.
ProblemPayment pipelines must never charge twice, and must survive consumer failures and redeliveries.
Sector 2
Architecture
- 01Producer service publishes payment events to a partitioned Kafka topic.
- 02Consumer group reads partitions in parallel.
- 03Each payment is checked against PostgreSQL before processing (idempotency) and then persisted.
- 04Failures are retried; results are published to downstream Kafka topics.
- 05Services are containerised with Docker.
DataPostgreSQL stores transactions and is the idempotency check that blocks duplicate payments.
Sector 3
Challenges
- Kafka may redeliver a message (at-least-once delivery).
- Idempotent processing keyed on the payment, so a redelivered event is detected and not applied twice.
- Transient failures during processing.
- Retry mechanism with error handling before results are published downstream.
- Throughput.
- Topic partitions + consumer groups for parallel processing.
GitHub repositoryLive demo (soon)
Next round
Employee Management System →