Skip to content

Conversation

@abeerfaiz
Copy link

No description provided.

Add required dependencies and configure Kafka producer for Task One

- Added pinned dependencies to pom.xml:
  * spring-boot-starter-data-jpa (3.2.5)
  * spring-boot-starter-web (3.2.5)
  * spring-kafka (3.1.4)
  * h2 (2.2.224)
  * spring-boot-starter-test (3.2.5)
  * spring-kafka-test (3.1.4)
  * testcontainers-kafka (1.19.1)
- Configured KafkaProducer component to send Transaction objects
  using topic name injected from application.yml
- Added application.yml with general.kafka-topic property
- Verified project builds successfully and TaskOneTests runs without errors
…ges (Task Two)

Implement Kafka consumer integration for Midas Core (Task Two)

- Added KafkaTransactionListener to consume Transaction messages from Kafka
- Configured consumer to read topic from application.yml (general.kafka-topic)
- Enabled JSON deserialization of incoming Transaction payloads
- Verified successful message reception using embedded Kafka with TaskTwoTests
- Recorded first four transaction amounts to confirm correct deserialization

This completes the Kafka consumer integration for Midas Core, enabling the backend
to asynchronously receive and handle incoming transactions from the message queue.
…k Three)

- Added TransactionRecord entity to persist validated transactions
- Implemented many-to-one relationships between TransactionRecord and UserRecord
- Updated KafkaTransactionListener to validate and process incoming transactions:
    • Ensure sender and recipient IDs are valid
    • Verify sender has sufficient balance
    • Update sender and recipient balances accordingly
    • Record valid transactions in the H2 database
- Configured in-memory H2 database with JPA auto schema generation
- Verified integration using TaskThreeTests and confirmed balance updates for users

This completes Task Three: integrating Midas Core with an H2 database and enabling
real-time transaction validation and persistence through Kafka events.
Integrated Incentives API (running on port 8080) into the post-validation transaction process.

Added RestClientConfig to register a RestTemplate bean for HTTP communication.

Created Incentive DTO with a single amount field to map API responses.

Enhanced KafkaTransactionListener to call /incentive after each validated transaction and retrieve incentive value.

Added incentive amount to recipient’s balance while leaving sender’s balance unchanged.

Extended TransactionRecord entity to include a new incentive column for persistence.

Verified end-to-end flow using TaskFourTests with the Incentives API JAR running locally.
Add BalanceController that returns a JSON serialized Balance for the given userId.
Looks up UserRecord via UserRepository and returns zero when the user does not exist.
Runs alongside the existing Kafka listener. Verified with TaskFiveTests
@abeerfaiz abeerfaiz closed this Nov 6, 2025
@abeerfaiz abeerfaiz reopened this Nov 6, 2025
abeerfaiz added a commit to abeerfaiz/forage-midas that referenced this pull request Nov 6, 2025
Complete J.P. Morgan Forage Midas Virtual Experience (Tasks 1–5) vagabond-systems#163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant