This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring Batch: use cases?

 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Folks!
Could someone please help me to understand what for Spring Batch?
I've examined an example, which made me think that this framework can divide big job in several steps and also I've found that there a lot of classes for manipulating files provided (org.springframework.batch.item.file.* for example).
But what are the real use-cases of this framework? What it is designed for? Read file --> process --> write file?
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you ever worked in an environment where you have to do a lot of batch processing? This can be quite different from a typical web application which has to work 24/7. But in classic environments it's not unusual to do the heavy lifting for example during the night when there are no regular users using your system. Batch processing includes typical tasks like reading and writing to files, transforming data, reading from or writing to databases, create reports, import and export data and things like that. Often these steps have to be chained together or you have to create more complex workflows where you have to define which job steps can be run in parallel or have to be run sequentially etc. That's where a framework like Spring Batch can be very handy.

Marco
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marco Ehrentreich wrote:Have you ever worked in an environment where you have to do a lot of batch processing?

We had a web-app which did batch processing during night, but it was sufficient to use "org.springframework.scheduling.quartz", which executes a job according to cron expression. I know there wasn't any dependencies between our jobs. But is it really beneficial to have dependencies and the whole framework needs to be included just for that?
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's not unusual to have more complex environments where a simple scheduler like Quartz is not enough - although it's really a very helpful tool. Maybe you have batch jobs which have to run depending on the availability of another system or it's only allowed to run a job after other jobs have finished their work (successfully). Moreover there are other features which can be very helpful for batch jobs like processing big volumes of data in chunks, executing jobs in parallel or synchronizing jobs or being able to restart a job at the last position of its progress if it crashed for some reason. And there are many other issues addressed by Spring Batch like transaction handling, messaging, processing of different file formats, transforming data, read and writing data etc.

Of course you could build all that on top of something like Quartz but why would you do that if there's an existing framework which offers all these features?

Marco
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is the best answer which I was waiting for. Thank you, Marco, for use cases. Now I'll go and dig a little bit deeper in the framework.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome! I'm glad that I could help you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic