Migrating COBOL Batch to Spring Batch
Bulk data processing usually performs asynchronous due to the transitional engine capabilities. Batch processing is suitable for optimizing the execution of high-volume repetitive tasks.
Join the DZone community and get the full member experience.Join For Free
Bulk data processing usually performs asynchronous due to the transitional engine capabilities. Batch processing is suitable for optimizing the execution of high-volume repetitive tasks. The mainframe batch mainly prevents parallel processing due to the mono thread model, locking I/O to data storage as its design. COBOL prevents concurrent processing, which leads to a higher Total Cost of Ownership (TCO). Practical and cost-optimized architectures are available to modernize the existing COBOL Batch to:
- Spring Batch microservices.
- Real-time Batch microservices on Cloud.
Spring Batch Microservices:
Spring Batch is designed as a lightweight, comprehensive framework to enable robust batch applications. Provides reusable functions to process large volumes of records, including features like
- Logging and tracking.
- Transaction management.
- Statistics on jobs.
- Retry and Skip logic features.
- Chunk-based processing.
- Web-based administration interface.
Spring batch architecture consists of three core components, namely Application, Batch Core, and Batch Interface.
- Application — Batch Program Codebase.
- Batch Core — API classes needed to control and launch a Batch Job.
- Batch Infrastructure — Component contains the readers, writers, and services used by both application and Batch Core components.
The Key concepts in Spring Batch involves:
- A batch job is composed of a sequence of one or more steps.
- Job instance of a job configured with parameters.
- A step is an independent, discrete unit of work in a job.
- A simple step may load data from a file into the database/more complex.
- Job execution is the single attempt of a job run.
- Step execution is a single attempt of a Step associated with a Job Execution.
- Job repository is persistence storage for maintaining the Batch Domain model and associated state for a job.
- Job execution listener is an extension point for customizing job execution events.
- Step execution listener is an extension point for customizing step execution events.
- Remote chunking, partitioning is a pattern for scalable distributed batch processing.
Real-Time Batch Microservices in Cloud:
Cloud platforms are available to modernize Legacy COBOL Batch to Microservices in Cloud. Blu Age, Micro Focus are some of the AWS patterns to modernization with automation for reverse-engineering the legacy procedural mainframe applications (code+data) and forward-engineering to new Microservice-ready object-oriented applications.
Modernizing from mainframe monoliths toward AWS, both the transformation and the target architecture definition are automated and standardized for AWS by the vendor software transformation technology running on AWS.
Successful approach for the mainframe to AWS migration consist of two-phase called:
- Business Split transformation phase — focuses on creating domain model boundaries for each Microservice.
- Technical stack transformation phase — focuses on application code and data operational migration process.
Advantages of Java Spring Batch Over COBOL Batch
- Maintainability — Spring Batch framework simplifies development by providing testing and exception handling tools, logs
- Flexibility — Spring Boot runs on any JVM. Reuse and share the logic between jobs.
- Scalability — Spring Bath is having capable of parallel processing. The mainframe is not having a parallel processing feature.
- Availability — Mainframe computation is very costly and impacts other programs available in peak times. Using Spring Batch job can be scheduled, executed, stop, and restart without affecting data integrity.
- Security — Spring Batch, the developer is solely responsible for using the right components and configurations for each Job. Spring Batch provides integrity of data without exposing sensitive data.
The COBOL Batch programs designed locking and waiting for transactions, whereas the Spring Batch avoids multiple user locking and waiting for transactions.
For the technical stack Spring Batch Microservice transformation phase, the mainframe Batch architecture is refactored (Manual/Automated) in the following way:
REST APIs — REST APIs available for each job enables remote call capability. A typical integration strategy with any API Gateway.
Java/Spring Programs — All scripts (COBOL programs, JCLs) transformed into Java reusable programs. Job Scheduler, Job Launcher, and Execution programmed in Java/Spring Batch API.
Persistence Data Store — Processed data persisted in RDBMS. Flat files/database used for audit logging and unprocessed records.
Opinions expressed by DZone contributors are their own.