DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Batch Processing Large Data Sets with Spring Boot and Spring Batch
  • Actuator Enhancements: Spring Framework 6.2 and Spring Boot 3.4
  • How Spring Boot Starters Integrate With Your Project
  • SmartXML: An Alternative to XPath for Complex XML Files

Trending

  • Java 8 Optional - Avoid Null and NullPointerException Altogether - and Keep It Pretty
  • Replay, Scheduling, and Throttling: Engineering a Self-Service Kafka Streaming Tool at Scale
  • Putting Guardrails Around What Your AI Agent Is Allowed to Touch
  • Beyond @Transactional: Solving the Dual-Write Problem in Distributed Microservices

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Coding
  3. Frameworks
  4. Spring Batch Process XML Delete/Move Files After Processing

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.

By 
Damodhara Reddy Palavali
·
Jul. 11, 19 · Code Snippet
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
18.1K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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!

Spring Framework XML Spring Batch Spring Boot Processing

Opinions expressed by DZone contributors are their own.

Related

  • Batch Processing Large Data Sets with Spring Boot and Spring Batch
  • Actuator Enhancements: Spring Framework 6.2 and Spring Boot 3.4
  • How Spring Boot Starters Integrate With Your Project
  • SmartXML: An Alternative to XPath for Complex XML Files

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook