Skip to content

Conversation

Akshit358
Copy link

  • Added required Spring Boot 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)
    • kafka from org.testcontainers (1.19.1)
  • Created application.properties with:

    • Kafka topic configuration
    • H2 database configuration
    • JPA/Hibernate settings
  • TaskOneTests now runs successfully with all dependencies

- Added required Spring Boot 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)
  - kafka from org.testcontainers (1.19.1)

- Created application.properties with:
  - Kafka topic configuration
  - H2 database configuration
  - JPA/Hibernate settings

- TaskOneTests now runs successfully with all dependencies
- Added application.yml with Kafka topic configuration
- Created KafkaTransactionListener to receive and log transactions
- Added KafkaConfig with producer and consumer configurations
- Fixed JSON serialization for Transaction objects
- Successfully integrated Kafka into Midas Core

Task 2 completed: Kafka listener receives transactions from topic
- Created TransactionRecord entity with JPA annotations and relationships
- Added TransactionRecordRepository for database operations
- Updated UserRepository to include findByName method
- Created TransactionService with validation and processing logic
- Created UserService for user operations
- Updated KafkaTransactionListener to use TransactionService
- Implemented transaction validation (sender/recipient exists, sufficient balance)
- Added balance updates and transaction recording
- Created WaldorfBalanceTest to verify functionality

Task 3 completed: H2 database integration with transaction validation and recording
Waldorf's final balance: 444 (rounded down)
- Created Incentive entity class for API responses
- Updated TransactionRecord entity to include incentive field
- Created IncentiveService for REST API communication
- Added RestConfig with RestTemplate bean
- Updated TransactionService to call incentive API after validation
- Implemented incentive logic: recipient gets transaction amount + incentive
- Added WilburBalanceTest to verify functionality
- Started incentive API service on port 8080

Task 4 completed: Incentive API integration with transaction processing
Wilbur's final balance: 3476 (rounded down)
- Created BalanceController with /balance endpoint on port 33400
- Added GET endpoint that accepts userId parameter and returns Balance object
- Returns balance 0.0 for non-existent users as required
- Updated application.yml to configure server port 33400
- Fixed TransactionService to use UserService instead of direct repository access
- Successfully tested with TaskFiveTests showing all user balances
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