https://grokonez.com/spring-framework/spring-batch/configure-spring-batch-step-restart

How to configure Spring Batch Step for restart

In How to use Spring Batch Restartable Function, we had discussed about how to restart a Job. Today, JavaSampleApproach will guide you how to use additional configuration for step in case restart a Batch Job.

Related articles:

  1. How to use Spring Batch Restartable Function
  2. Spring Batch XML Config by Spring Boot

I. Technologies

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

II. Overview

1. Introduction

For default, when running a restartable Batch Job, a step is executed if it was FAILED in a previous execution and do NOT be invoked if it was COMPLETED. Spring Batch also supports some specific configuration for Steps when restart a Job. - Setting a StartLimit: help control the number of times that a Step may be started.
<step id="step3">
    <tasklet start-limit="${limitstart}" ref="taskletStep3"/>
</step>
  • allow-start-if-complete: in case restartable Job, steps with the configuration allow-start-if-complete=“true” are always be invoked to run.
<step id="step3">
    <tasklet start-limit="${limitstart}" ref="taskletStep3"/>
</step>

2. Project Structure

In the tutorial, a Job will be created with 3 step: step1->step2->step3 - Step1 with no additional configuration - Step2 is configured with allow-start-if-complete="true" - Step3 is configured with start-limit="${limitstart}"

More at:

https://grokonez.com/spring-framework/spring-batch/configure-spring-batch-step-restart

How to configure Spring Batch Step for restart

#springbatch #restart #springboot

How to configure Spring Batch Step for restart » grokonez
1.95 GEEK