This repository contains my completed solution for the Midas Core component as part of the JPMorgan Chase Software Engineering Virtual Experience on Forage.
The project simulates a production-grade financial processing system that integrates Kafka, Spring Boot, H2 Database, and a REST Incentive API, all designed to mimic a real-world microservices environment.
Midas Core is the central component responsible for:
- Receiving real-time transaction events via Kafka
- Validating and storing financial transactions in a SQL database
- Applying incentives from an external REST API
- Exposing user balances through a REST endpoint
- Forked and cloned the scaffolded repo:
vagabond-systems/forage-midas
- Configured the project in IntelliJ with Java 17 and Maven
- Added required dependencies to
pom.xml
:spring-boot-starter-data-jpa
spring-boot-starter-web
spring-kafka
h2
spring-boot-starter-test
spring-kafka-test
testcontainers-kafka
- Verified setup by running
TaskOneTests
- Implemented a Kafka listener that:
- Listens to the topic defined in
application.yml
- Deserializes incoming messages to
Transaction
objects
- Listens to the topic defined in
- Verified functionality using in-memory Kafka provided in the test suite
- Ran
TaskTwoTests
and used debugger to inspect message handling
- Created
TransactionRecord
entity to persist valid transactions - Implemented validation rules:
- Valid sender and recipient IDs
- Sufficient sender balance
- Updated balances upon successful transaction processing
- Ensured one-to-many relationships between
User
andTransactionRecord
- Ran
TaskThreeTests
and verified post-processing balances
- Integrated external API using
RestTemplate
to post validated transactions - Received incentive amounts via
/incentive
endpoint - Stored incentives alongside transactions
- Adjusted recipient balances to include incentive amounts
- Ensured incentives were not deducted from sender balances
- Ran
TaskFourTests
and verified updated balances
- Developed a REST controller exposing a
GET /balance
endpoint - Accepts
userId
as a query parameter - Returns JSON response using the provided
Balance
class - Default response for unknown users: balance of 0
- Exposed service on port 33400
- Confirmed coexistence of Kafka listener and REST controller
- Ran
TaskFiveTests
for final verification
Tech | Description |
---|---|
Java 17 | Core programming language |
Spring Boot | Application framework |
Kafka | Asynchronous message broker |
H2 | In-memory SQL database |
REST API | External incentive service integration |
Maven | Dependency and build management |
JUnit | Testing framework |
src/
├── main/
│ └── java/
│ └── com/example/midascore/
│ ├── MidasCoreApplication.java
│ ├── config/
│ ├── controller/
│ ├── kafka/
│ ├── model/
│ ├── repository/
│ ├── service/
├── test/
│ └── java/
│ └── ... (TaskOneTests through TaskFiveTests)
- Clone the repo and navigate into it.
- Start the Incentive API (
services/incentive-api.jar
) on port8080
. - Run the Spring Boot application on port
33400
. - Use Postman or your browser to hit:
GET http://localhost:33400/balance?userId=someUser
- This project is based on the JPMorgan Chase Forage Internship
- Educational and non-commercial use only
- Original repo: vagabond-systems/forage-midas