TERASOLUNA Batch Framework for Java (5.x) Development Guideline - version 5.0.1.RELEASE, 2017-9-27
> 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 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 and skipping 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 offered 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 as 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 > Single data source > Implementing transaction control

Chunk Tasklet

7

Data input/output > Database access > Database access in ItemReader

Chunk

8

Data input/output > Database access > Database access in ItemWriter

Chunk

9

Application development flow > Create Tasklet model job > Tasklet implementation which use components of chunk model

Tasklet

10

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

Chunk Tasklet

11

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

Chunk Tasklet

12

Handling abnormalities > Input check

Chunk Tasklet

Chunk Tasklet

13

Handling abnormalities > Exception handling > Step unit exception handling > Exception handling by using ChunkListener interface

Chunk Tasklet

14

Handling abnormalities > Exception handling > Step unit exception handling > Exception handling in chunk model

Chunk

15

Handling abnormalities > Exception handling > Step unit exception handling > Exception handling in tasklet model

Tasklet

16

Handling abnormalities > Exception handling > Determine whether to continue processing > Skip

Chunk Tasklet

17

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

Chunk Tasklet

18

Job management > Customize exit code

Chunk Tasklet

19

Job management > Logging

Chunk Tasklet

Chunk Tasklet

20

Job management > Message management

Chunk Tasklet

Chunk Tasklet

TERASOLUNA Batch Framework for Java (5.x) Development Guideline - version 5.0.1.RELEASE, 2017-9-27