Spring Boot application that automatically processes transaction files from AWS S3 and loads them into Oracle Database
This is a production-ready, event-driven batch processing system that:
- π₯ Listens to AWS SQS for S3 file upload notifications
- π Streams transaction files directly from S3 (memory efficient)
- βοΈ Processes records in configurable chunks using Spring Batch
- πΎ Loads data into Oracle Database with full transaction management
- π Idempotent - DB-backed file log prevents duplicate processing
- π Monitors job execution with comprehensive logging
- β Zero manual intervention - fully automated processing
- β Scalable - handles files of any size with streaming
- β Resilient - late-ack SQS strategy, skip policy, visibility heartbeat, and retry with backoff
- β
Idempotent -
transaction_file_logtable prevents duplicate file processing - β Production-ready - rolling log files, comprehensive monitoring
AWS S3 Upload β S3 Event β SQS Message β Spring App β Stream File β Process Batch β Oracle DB
Detailed Flow:
βββββββββββββββ
β File Upload β User uploads transaction file
ββββββββ¬βββββββ
βΌ
βββββββββββββββ
β S3 Bucket β ObjectCreated event triggered
ββββββββ¬βββββββ
βΌ
βββββββββββββββ
β SQS Queue β Event notification queued
ββββββββ¬βββββββ
βΌ
βββββββββββββββ
β Spring Boot β @SqsListener receives message
β Application β
ββββββββ¬βββββββ
βΌ
βββββββββββββββ
β S3 Stream β Download as InputStream (no temp files)
ββββββββ¬βββββββ
βΌ
βββββββββββββββ
βSpring Batch β Reader β Processor β Writer (chunks)
ββββββββ¬βββββββ
βΌ
βββββββββββββββ
β Oracle DB β Persisted with transaction management
βββββββββββββββ
π See ARCHITECTURE.md for detailed technical design
| Component | Version | Required |
|---|---|---|
| Java JDK | 21+ | β |
| Maven | 3.6+ | β |
| Oracle Database | 12c+ | β |
| AWS Account | - | β |
| AWS CLI (optional) | 2.x | β |
cd d:\Java_Projects\transaction-batch-processEdit src/main/resources/application.yml with your Oracle and AWS details.
AWS credentials are resolved via the AWS Default Credential Provider Chain β configure ~/.aws/credentials, environment variables (AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY), or an IAM role. No credential properties are read from application.yml.
mvn clean packagejava -jar target/transaction-batch-process-1.0.0.jar# Upload sample file
aws s3 cp sample-data/transactions.txt s3://your-bucket/test.txtWatch the logs for automatic processing! π
π Need help? See QUICKSTART.md for 10-minute setup guide
The application processes # delimited flat files:
673440#245894#MGEIQ3RW9Q#2021-12-23#4459.12#3011.44#CREDIT#70945.54
673441#245895#MGEIQ3RW9R#2021-12-24#0.00#5000.00#DEPOSIT#75945.54
No header row β data starts at line 1.
| Field | Type | Description |
|---|---|---|
customerId |
String | Customer identifier |
trans_num |
String | Transaction number |
transaction_id |
String | Unique transaction ID |
transaction_date |
Date | Format: YYYY-MM-DD |
withdrawal_amount |
Decimal | Withdrawal amount (use 0.00 if none) |
deposit_amount |
Decimal | Deposit amount (use 0.00 if none) |
transaction_type |
String | CREDIT/DEBIT/WITHDRAWAL/DEPOSIT |
balance |
Decimal | Account balance after transaction |
# Database Configuration
spring:
datasource:
url: jdbc:oracle:thin:@localhost:1521/XEPDB1 # service name format, not SID
username: your_oracle_user
password: your_oracle_password
# AWS Configuration (credentials via Default Credential Provider Chain, not here)
aws:
region: ap-south-1
s3:
bucket-name: your-transaction-bucket
sqs:
queue-url: https://sqs.ap-south-1.amazonaws.com/account-id/your-queue
# Batch Configuration
batch:
chunk-size: 1000 # Records per chunk
skip-limit: 2147483647 # Integer.MAX_VALUE β individual failures never abort the job
file-delimiter: "#"
enable-dml-error-logging: true
fallback-initial-delay-ms: 500 # Delay before individual fallback inserts
lock-retry-max-attempts: 3 # Max retries for transient lock errors
lock-retry-base-delay-ms: 200 # Exponential backoff base (ms)
lock-retry-max-delay-ms: 2000 # Exponential backoff ceiling (ms)CREATE TABLE transaction_process (
id NUMBER(19) PRIMARY KEY,
customer_id VARCHAR2(50) NOT NULL,
trans_num VARCHAR2(50) NOT NULL,
transaction_id VARCHAR2(50) UNIQUE NOT NULL,
transaction_date DATE NOT NULL,
withdrawal_amount NUMBER(15, 2),
deposit_amount NUMBER(15, 2),
transaction_type VARCHAR2(20) NOT NULL,
balance NUMBER(15, 2) NOT NULL,
file_name VARCHAR2(255),
processed_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);The DDL is in src/main/resources/schema.sql and must be applied manually before first run β initialize-schema: never is set intentionally.
- Event-driven architecture with SQS
- No manual job triggering required
- Processes files immediately after upload
- Streaming from S3 (no temp files)
- Chunk-based processing
- Minimal memory footprint
- DB-backed file log (
transaction_file_log) prevents duplicate processing - UNIQUE constraint on object key with status machine (IN_PROGRESS β COMPLETED | FAILED)
- Failed files can be retried automatically on SQS redelivery
- Late SQS acknowledgment β only on success; failures redeliver automatically
- Visibility heartbeat keeps messages invisible during long-running jobs
- Configurable skip policy (default: unlimited)
- DML error logging scoped per file via
ORA_ERR_TAG$ - Fallback individual inserts with exponential backoff on lock errors
- Job status verified before marking complete
- Job execution statistics via TransactionJobListener
- Read/Write/Skip counters
- Processing time tracking
- Rolling log files (50MB/file, 30-day history, 1GB cap)
- AWS SDK log noise suppressed (WARN level)
- Horizontal scaling (multiple instances with DB-level idempotency)
- Configurable chunk size
- Java 21 Virtual Threads enabled globally
- Database connection pooling
| Metric | Value |
|---|---|
| Throughput | 10,000-50,000 records/min |
| Memory Usage | ~50-100MB base + chunks |
| Chunk Size | 1000 (configurable) |
| Skip Limit | Integer.MAX_VALUE (configurable) |
- S3 Bucket - for transaction file storage
- SQS Queue - for event notifications
- IAM User/Role - with S3 read and SQS permissions
# Create S3 bucket
aws s3 mb s3://your-transaction-bucket --region ap-south-1
# Create SQS queue
aws sqs create-queue --queue-name transaction-file-queue
# Configure S3 β SQS notification
# (See detailed steps in AWS_SETUP_GUIDE.md)π Complete guide: See AWS_SETUP_GUIDE.md
| Document | Description |
|---|---|
| INDEX.md | π Complete project overview and index |
| QUICKSTART.md | β‘ Get running in 10 minutes |
| SETUP.md | π οΈ Detailed setup and deployment guide |
| AWS_SETUP_GUIDE.md | βοΈ Step-by-step AWS configuration |
| ARCHITECTURE.md | ποΈ Technical architecture and design |
| PROJECT_SUMMARY.md | π Complete feature list and specs |
| JDBCTEMPLATE_IMPLEMENTATION.md | π§ JdbcTemplate batch operations guide |
mvn test# 1. Upload sample file
aws s3 cp sample-data/transactions.txt s3://your-bucket/
# 2. Watch logs for processing
Get-Content logs/transaction-batch.log -Tail 50 -Wait
# 3. Verify in database
sqlplus user/pass@host:1521/ORCL
SELECT COUNT(*) FROM transaction_process;# Test connection
sqlplus username/password@host:1521/ORCL- Verify S3 event notification is configured
- Check SQS queue policy allows S3
- Test manually:
aws sqs receive-message --queue-url YOUR_URL
- Verify IAM credentials have S3 read permissions
- Test:
aws s3 ls s3://your-bucket
π More solutions in SETUP.md troubleshooting section
INFO - Received SQS message
INFO - Processing S3 event: bucket=my-bucket, key=transactions.txt
INFO - === Starting Transaction Processing Job ===
INFO - Batch write completed: 1000 successful, 0 skipped
INFO - === Transaction Processing Job Completed ===
INFO - Job Status: COMPLETED
INFO - Records Read: 10000
INFO - Records Written: 10000
INFO - Duration: 45 seconds
- Job execution time
- Records processed per minute
- Skip/error rate
- SQS message processing time
- Database connection pool usage
β No hardcoded credentials β Environment variable support β .gitignore for sensitive files β Connection pooling with timeouts
- Use AWS IAM roles (instead of access keys)
- Store credentials in AWS Secrets Manager
- Enable SSL/TLS for Oracle connections
- Regular credential rotation
- Enable CloudTrail for audit logging
transaction-batch-process/
βββ src/main/java/com/transaction/batch/
β βββ TransactionBatchProcessApplication.java # Main app
β βββ config/ # Batch, AWS, app config + reader/processor/writer/listeners
β βββ model/ # Java records (TransactionRecord, TransactionProcess, S3EventNotification, ProcessingOutcome)
β βββ service/ # SqsListenerService, S3Service, BatchJobService, FileProcessingLogService
βββ src/main/resources/
β βββ application.yml # Configuration
β βββ schema.sql # Database DDL (applied manually)
β βββ logback-spring.xml # Rolling file appender + log levels
βββ sample-data/
β βββ transactions.txt # Sample file
βββ docs/ # Documentation files
- Spring Boot 3.4.0 - Application framework
- Spring Batch - Batch processing
- JdbcTemplate - Database access (no JPA/Spring Data)
- AWS SDK 2.29.0 - S3 and SQS integration
- Oracle JDBC 23.5.0 - Database driver
- HikariCP - Connection pooling
- Lombok - Code simplification
- Jackson - JSON processing
mvn spring-boot:runmvn clean package -DskipTests
java -jar target/transaction-batch-process-1.0.0.jardocker build -t transaction-batch-process .
docker run -p 8080:8080 transaction-batch-processSee SETUP.md for systemd/Windows Service configuration
- β Review code structure
- β Test with sample data
- β¬ Customize processor for business rules
- β¬ Add additional validation
- β¬ Implement custom monitoring
- β¬ Configure production database
- β¬ Set up production AWS resources
- β¬ Use IAM roles for authentication
- β¬ Configure CloudWatch monitoring
- β¬ Set up log aggregation
- β¬ Deploy as system service
- Check application logs
- Review documentation files
- Verify AWS and database connectivity
- Check
docs/SETUP.mdfor troubleshooting
[Your License Here]
Built with:
- Spring Framework
- AWS SDK for Java
- Oracle Database
- Maven
- π Complete Index
- β‘ Quick Start Guide
- π οΈ Setup Instructions
- βοΈ AWS Configuration
- ποΈ Architecture Details
- π§ JdbcTemplate Implementation
Ready to process transactions at scale! π