A distributed banking system built with Java and Apache Kafka, comprising multiple microservices that process card transactions and detect suspicious activity based on location mismatches. Includes services for transaction validation, customer notifications, account management, and reporting, all communicating through Kafka topics with a fault-tolerant multi-broker cluster.
- bank-api-service: entry point to the system. Reads incoming customer card transactions and, for each one, looks up the customer's home address and compares it against the transaction location. Valid transactions (locations match) are produced to
valid-transactions, mismatches tosuspicious-transactions, and any transaction over 1000 is also produced tohigh-value-transactions. Kafka message key is the username, value is theTransaction. - user-notification-service: consumes
suspicious-transactionsand surfaces them for customer approval. - account-manager: consumes
valid-transactionsand processes them for normal settlement. - reporting-service: consumes
valid-transactions,suspicious-transactionsandhigh-value-transactionsfor reporting across all transaction activity.
All inter-service communication runs through Kafka topics.
Fault-tolerant, scalable cluster:
- 3 brokers, listening on ports 9092, 9093 and 9094
valid-transactions: 3 partitions, replication factor 3suspicious-transactions: 2 partitions, replication factor 3high-value-transactions
- Java 21+, Maven multi-module reactor
- Apache Kafka clients 4.3.0
- SLF4J + Logback
- JUnit 5 + Mockito
- Docker
docker compose up -dBrings up a 3-broker cluster (ports 9092, 9093, 9094) and creates valid-transactions, suspicious-transactions and high-value-transactions.
./scripts/build.sh./scripts/start-bank-service.sh
./scripts/start-account-service.sh
./scripts/start-user-service.sh
./scripts/start-reporting-service.shbank-api-service reads transactions from user-transactions.txt and produces to Kafka; the other three consume and print what they receive.

