Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Spring Batch Process XML Delete/Move Files After Processing

DZone 's Guide to

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.

· Database Zone ·
Free Resource

Image title

See 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:

  1. Multiple schedulers in one configuration

  2. Parse XML nested elements to DB

  3. Tasklet to move file

  4. Tasklet to archive and delete file

  5. 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!

Topics:
database ,tutorial ,d ,sql code snippet ,sql ,spring boot ,spring batch

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}