Skip to content

SDU-OpenSources/SpringBatch-LMS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpringBatch-LMS

Spring Batch

Spring Batch is a open source framework for enterprise batch processing. This basically means execution of various steps in pipeline. It is a flexible framework where a job is executed which consists of several steps and each step consists of READ-PROCESS-WRITE process(or a tasklet).

Steps

Each step in Spring Batch consists of Read-Process-Write process for which we need to implement ItemReader, ItemProcessor and ItemWriter respectively. JobLauncher is responsible for starting the job and executing all the Steps chained together.

Project

In this repository, a basic implementation of Spring Batch is created where a simple job of updating host system status is implemented.

Class Description
App.java Application Driving Class with Job Launcher
BatchConfiguration.java Spring Batch Configuration class with ItemReader, ItemProcessor, ItemWriter and DataSource Beans
HostSystemStatusItemReader.java Custom Reader Class with list of POJOs to be processed
HostSystemStatusItemProcessor.java Custom Processor where any massaging can be done over input data
HostSystemStatusItemWriter.java Custom Writer Class which can be used to perform any user defined operations for write phase
HostSystemStatusPojo.java Typical Pojo class

Steps to get it up and running.

Import

Import the project as an existing maven project in Eclipse.

  1. Download project source code and unzip it into a folder location.
  2. From Eclipse, Project Explorer -> Right click -> Select Import Menu and Import.
  3. Expand Maven menu.
  4. And click Existing Maven Projects. Enter the project source code path from #1.

Fixing ojdbc7.jar Dependency

If maven build gives missing artifact exception for OJDBC Library :

Download ojdbc7.jar and execute following command by providing path to the download jar in command prompt.

mvn install:install-file -Dfile="Path/To/ojdbc7.jar" -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.2 -Dpackaging=jar

Configuration

Enter Oracle Database Details for LMS Schema in class BatchConfiguration.java(lines 108-110) inside DataSource Bean.

Execution

Run App.java.

Before Execution

After Execution

FLG_GLSTATUS and FLG_GLSUBSTATUS is updated from "ONLINE" to "BATCH" and "EOD STARTED" respectively.

Spring Batch Tables

Spring Batch automatically creates several meta-data tables in DB Schema during Batch execution for tracking purposes. To Learn more about these Meta-Data Tables, Please refer to this concise official doc here.

Table BATCH_JOB_INSTANCE

Table BATCH_JOB_EXECUTION

Table BATCH_JOB_EXECUTION_PARAMS

Table BATCH_JOB_EXECUTION_CONTEXT

Table BATCH_STEP_EXECUTION

Table BATCH_STEP_EXECUTION_CONTEXT

Read More?

Please find official Spring Batch documentation here.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages