Spring Batch Process XML Delete/Move Files After Processing
This example covers multiple Spring Batch concepts that we need in most of our daily routine batch job implementations.
Join the DZone community and get the full member experience.
Join For FreeSee how Spring Boot Batch Application saves an XML to the database and moves error/success files to error/success folder and archives error/success files.
This example covers multiple Spring Batch concepts that we need in most of our daily routine batch job implementations.
List of topics covered
Before going through this article, I assume you know about the basic concepts of Spring Boot, Batch, and how to create a project. This topic starts by creating classes required for the implementation of the current topic. If you are new to Spring batch, Spring Boot uses Spring Initializr to create projects. You can refer to the Spring Boot Documentation
List of topics covered:
Multiple schedulers in one configuration
Parse XML nested elements to DB
Tasklet to move file
Tasklet to archive and delete file
StepExecutionListener
We are using Stax.
SQL to create table:
CREATE TABLE “TEST_VEHICLE1”
( “ID” NUMBER(19,0) NOT NULL ENABLE,
“VEHICLENUMBER” VARCHAR2(10 BYTE),
“BRAND” VARCHAR2(100 BYTE),
“COUNTRY” VARCHAR2(100 BYTE),
“MODELNAME” VARCHAR2(35 BYTE),
“MODELYEAR” VARCHAR2(35 BYTE),
PRIMARY KEY (“ID”)
) ;
Go to GitHub for the complete code. Happy coding!
Opinions expressed by DZone contributors are their own.
Comments