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.
- High-throughput CSV batch ingestion
- Manual JDBC transaction management for ACID guarantees
- Multithreaded processing using
ExecutorServicewith 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
The application is organized into clear layers:
controller— job entry point and argument parsing (BatchJobController)processor— business logic for transforming and validating recordsdao— 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.
- Java 7
- Maven
- PostgreSQL (JDBC driver included)
- Log4j 1.2
- JUnit 4 for unit tests
- Java 7 JDK
- Maven 3.x
- PostgreSQL (or compatible JDBC-accessible RDBMS)
- A terminal or IDE capable of building/running Maven projects
-
Clone the repository:
git clone https://github.com/Nitish-Naik/java7-batch-transaction-processor.git cd java7-batch-transaction-processor
-
Create the database schema:
- Apply the SQL in databaseSchema/schema.sql.
- See
databaseSchema/accounts.mdanddatabaseSchema/transactions.mdfor schema notes.
-
Configure database connection and logging:
- Edit src/main/resources/db.properties with your JDBC URL, username, and password.
- Adjust logging in src/main/resources/log4j.properties as needed.
-
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). -
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.
- The application accepts a CSV file path as the primary argument. For advanced options, run the job from your IDE and inspect
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.
The canonical schema and notes live in the databaseSchema/ directory:
Use your preferred migration tool (Flyway, Liquibase) in production to manage schema changes.
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).
- Log4j is used for application logging. Logs go to console by default; configure
log4j.propertiesto change appenders/levels. - Failed-record audit reports are generated by
ReportGeneratorinsrc/main/java/com/enterprise/batch/util/ReportGenerator.java.
- Common issue: database connectivity — verify
db.propertiesand that the DB accepts connections from the host. - If the job stalls, increase logging to DEBUG and inspect thread dumps; verify the executor configuration.
Contributions are welcome. Suggested process:
- Fork the repository.
- Create a feature branch:
feature/your-feature. - Add tests for new behavior.
- Open a pull request with a clear description of the change.
Please follow Java 7 compatibility and keep changes minimal and well-tested.
This project is licensed under the MIT License — see LICENSE for details.
For questions or help, open an issue in this repository.