Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 10. Controlling execution > Externalizing flow definitions

10.4. Externalizing flow definitions

Reusability is the Holy Grail of software engineering. Spring Batch is part of this quest when it comes to reusing batch components and job configurations. Indeed, portions of a job configuration can be generic and reused across jobs. In the advanced version of our import products job, before reading and writing products from a flat file, preliminary steps prepare the ground for the import: a first step downloads the ZIP archive, a second step decompresses the archive, and a third step checks the integrity of the decompressed files. These preliminary steps are generic and could be useful to other jobs: it’s common for a batch job to import data from a file it has downloaded. Why not externalize this flow and reuse it in other jobs? Figure 10.14 illustrates the process of reusing a flow in multiple jobs.

Figure 10.14. A flow of steps can be defined as a standalone entity so that other jobs can reuse it. This promotes reusability of code and configuration.



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial