Skip to content

Nitish-Naik/java7-batch-transaction-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java 7 Batch Transaction Processor

License: MIT

Enterprise-grade batch transaction processing application implemented for Java 7. It ingests transaction files, applies JDBC-managed transactions with retry and isolation semantics, produces audit reports for failures, and is designed for robust, observable batch runs in production environments.

Key Features

  • High-throughput CSV batch ingestion
  • Manual JDBC transaction management for ACID guarantees
  • Multithreaded processing using ExecutorService with controlled concurrency
  • Retry-with-isolation for transient failures and per-record failure tracking
  • Audit and summary report generation for failed and processed records
  • Configurable via properties files; logging with Log4j

Architecture Overview

The application is organized into clear layers:

  • controller — job entry point and argument parsing (BatchJobController)
  • processor — business logic for transforming and validating records
  • dao — database access and transaction management (TransactionDaoImpl)
  • util — helpers for DB connections, file reading, reporting, and failure tracking

See the source tree under src/main/java/com/enterprise/batch for details.

Tech Stack

  • Java 7
  • Maven
  • PostgreSQL (JDBC driver included)
  • Log4j 1.2
  • JUnit 4 for unit tests

Prerequisites

  • Java 7 JDK
  • Maven 3.x
  • PostgreSQL (or compatible JDBC-accessible RDBMS)
  • A terminal or IDE capable of building/running Maven projects

Getting Started

  1. Clone the repository:

    git clone https://github.com/Nitish-Naik/java7-batch-transaction-processor.git cd java7-batch-transaction-processor

  2. Create the database schema:

    • Apply the SQL in databaseSchema/schema.sql.
    • See databaseSchema/accounts.md and databaseSchema/transactions.md for schema notes.
  3. Configure database connection and logging:

  4. Build the project:

    mvn clean package

    The project produces a shaded, runnable JAR: target/transaction-processor-1.0-SNAPSHOT.jar (main class: com.enterprise.batch.controller.BatchJobController).

  5. Run the batch job (example):

    java -jar target/transaction-processor-1.0-SNAPSHOT.jar /path/to/transactions.csv

    • The application accepts a CSV file path as the primary argument. For advanced options, run the job from your IDE and inspect BatchJobController.

Configuration

  • src/main/resources/db.properties — database connection settings (JDBC URL, user, password)
  • src/main/resources/log4j.properties — logging configuration

Keep sensitive credentials out of source control for production; prefer externalized configuration or environment variables.

Database Schema & Migrations

The canonical schema and notes live in the databaseSchema/ directory:

Use your preferred migration tool (Flyway, Liquibase) in production to manage schema changes.

Tests

Run unit tests with:

mvn test

Tests are implemented with JUnit 4. See src/test/java and src/main/java for examples (e.g., TransactionServiceTest).

Logging & Reports

  • Log4j is used for application logging. Logs go to console by default; configure log4j.properties to change appenders/levels.
  • Failed-record audit reports are generated by ReportGenerator in src/main/java/com/enterprise/batch/util/ReportGenerator.java.

Troubleshooting

  • Common issue: database connectivity — verify db.properties and that the DB accepts connections from the host.
  • If the job stalls, increase logging to DEBUG and inspect thread dumps; verify the executor configuration.

Contributing

Contributions are welcome. Suggested process:

  1. Fork the repository.
  2. Create a feature branch: feature/your-feature.
  3. Add tests for new behavior.
  4. Open a pull request with a clear description of the change.

Please follow Java 7 compatibility and keep changes minimal and well-tested.

License

This project is licensed under the MIT License — see LICENSE for details.

Contact

For questions or help, open an issue in this repository.


About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages