DEV Community

loizenai
loizenai

Posted on

How to use Spring Batch Restartable Function

https://grokonez.com/spring-framework/spring-batch/use-spring-batch-restartable-function

How to use Spring Batch Restartable Function

SpringBatch provides a restartable mechanics with a Job, in the How to use Spring Batch Restartable Function tutorial, JavaSampleApproach will present to you the principle of this function with SpringBoot.

Related Post:

  1. How to configure Spring Batch Step for restart
  2. How to start with Spring Batch using Spring Boot – Java Config
  3. Spring Batch XML Config by Spring Boot
  4. Spring Batch Job with Parallel Steps
  5. How to import CSV data to PostgreSQL Database using Spring Batch Job

I. Technologies

– Java 1.8
– Maven 3.3.9
– Spring Boot: 1.4.3.RELEASE
– Spring Tool Suite – Version 3.8.1.RELEASE

II. Overview

Create a Batch Job which has a simple step with a Reader & Writer.
Reader reads a list file-paths then pass them to a Writer. The Write uses file paths to process content of each file.
With created JOB, test a restartable function base on FileNotFound Error.
Note: a Batch Job is created with restartable default. Spring Batch also supports configuration to prevent the restartable function.

1. Project Structure

spring boot springbatch restartable project structure

2. Step to do

  • Create SpringBoot project
  • Create simple step
  • Config a Batch Job
  • Create a Job Launch controller
  • Config Batch Job Database
  • Enable Batch Job
  • Scenario Test

https://grokonez.com/spring-framework/spring-batch/use-spring-batch-restartable-function

How to use Spring Batch Restartable Function

Top comments (0)