TERASOLUNA Batch Framework for Java (5.x) Development Guideline - version 5.1.1.RELEASE, 2018-3-16
> INDEX

Background

Some mass retail stores issue point cards for members.
Membership types include "Gold member", "Normal member" and the services are provided based on the membership types.
As a part of the service, 100 points are added for "gold members" and 10 points are added for "normal members" at the end of the month, for the members who have purchased a product during that month.

Process overview

TERASOLUNA Batch 5.x will be using an application as a monthly batch process which adds points based on membership type.

Business specifications

Business specifications are as shown below.

  • "Members who have purchased a product within the month" are indicated by "product purchasing" flag

    • Product purchasing flag "0" indicates initial state whereas "1" indicates processing target

  • When Product purchasing flag is "1"(processing target), points are added according to membership type

    • Add 100 points when membership type is "G"(gold member) and add 10 points when membership type is "N"(Normal member)

  • Product purchasing flag is updated to "0" (initial state) after adding points

  • Upper limit for the points is 1,000,000 points

  • If the points exceed 1,000,000 points after adding the points, they are adjusted to 1,000,000 points

Learning contents

We will learn about various functions and processing methods related to jobs by creating applications (jobs) for simple business specifications.
Note that jobs implement tasklet model and chunk model respectively.
The main learning in each job is the functions and processing methods used in the job are shown below.

Jobs created in this tutorial
Sr. No. Jobs Contents learnt

A

A job that inputs/outputs data by accessing a database

Learn about database access method which use ItemReader and ItemWriter for MyBatis.

B

A job that inputs/outputs data by accessing a file

Learn about file access method which use ItemReader and ItemWriter for input and output of a flat file.

C

A job that validates input data

Learn input check methods using Bean Validation.

D

A job that performs exception handling by ChunkListener

Learn exception handling methods which use ChunkListener as a listener.

E

A job which performs exception handling by try-catch

Learn exception handling which use try-catch, and a method which outputs customised exit codes.

F

Asynchronous execution type job

Learn the methods of asynchronous execution which use DB polling function provided by TERASOLUNA Batch 5.x.

Correspondence table for functions and processing methods used in A~F jobs, and explanation of TERASOLUNA Batch 5.x Development guideline is shown below.

Correspondence table for A~F jobs and TERASOLUNA Batch 5.x Development guideline explanation
Sr. No. Functions A B C D E F

1

Start job > Activation method > Synchronous execution

Chunk Tasklet

Chunk Tasklet

Chunk Tasklet

Chunk Tasklet

Chunk Tasklet

2

Start job > Activation method > Asynchronous execution (DB polling)

Chunk Tasklet

3

Start job > Start-up parameters of job > Assign from command line argument

Chunk Tasklet

4

Start job > Listener

Chunk Tasklet

Chunk Tasklet

5

Data input/output > Transaction control > Transaction control in Spring Batch

Chunk Tasklet

6

Data input/output > Transaction control > In case of single data source > Implementation of transaction control

Chunk Tasklet

7

Data input/output > Database access > Input

Chunk Tasklet

8

Data input/output > Database access > Output

Chunk Tasklet

9

Data input/output > File access > Variable length record > Input

Chunk Tasklet

10

Data input/output > File access > Variable length record > Output

Chunk Tasklet

11

Handling abnormalities > Input check

Chunk Tasklet

Chunk Tasklet

12

Handling abnormalities > Exception handling > Exception handling in step unit > Exception handling by ChunkListener interface

Chunk Tasklet

13

Handling abnormalities > Exception handling > Exception handling in step unit > Exception handling in chunk model

Chunk

14

Handling abnormalities > Exception handling > Exception handling in step unit > Exception handling in tasklet model

Tasklet

15

Handling abnormalities > Exception handling > Decide whether to continue the process > Skip

Chunk Tasklet

16

Job management > Job status management > Verify job status and execution results

Chunk Tasklet

17

Job management > Customize exit code

Chunk Tasklet

18

Job management > Logging

Chunk Tasklet

Chunk Tasklet

19

Job management > Message management

Chunk Tasklet

Chunk Tasklet

TERASOLUNA Batch Framework for Java (5.x) Development Guideline - version 5.1.1.RELEASE, 2018-3-16