Spring Batch in Action
eBook - ePub

Spring Batch in Action

Arnaud Cogoluegnes, Thierry Templier, Olivier Bazoud

Share book
  1. 504 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Spring Batch in Action

Arnaud Cogoluegnes, Thierry Templier, Olivier Bazoud

Book details
Book preview
Table of contents
Citations

About This Book

Summary Spring Batch in Action is an in-depth guide to writing batch applications using Spring Batch. Written for developers who have basic knowledge of Java and the Spring lightweight container, the book provides both a best-practices approach to writing batch jobs and comprehensive coverage of the Spring Batch framework.
About the Technology
Even though running batch jobs is a common task, there's no standard way to write them. Spring Batch is a framework for writing batch applications in Java. It includes reusable components and a solid runtime environment, so you don't have to start a new project from scratch. And it uses Spring's familiar programming model to simplify configuration and implementation, so it'll be comfortably familiar to most Java developers.
About the Book
Spring Batch in Action is a thorough, in-depth guide to writing efficient batch applications. Starting with the basics, it discusses the best practices of batch jobs along with details of the Spring Batch framework. You'll learn by working through dozens of practical, reusable examples in key areas like monitoring, tuning, enterprise integration, and automated testing.No prior batch programming experience is required. Basic knowledge of Java and Spring is assumed. Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.
What's Inside

  • Batch programming from the ground up
  • Implementing data components
  • Handling errors during batch processing
  • Automating tedious tasks

Table of Contents

PART 1 BACKGROUND

  • Introducing Spring Batch
  • Spring Batch concepts
  • PART 2 CORE SPRING BATCH
  • Batch configuration
  • Running batch jobs
  • Reading data
  • Writing data
  • Processing data
  • Implementing bulletproof jobs
  • Transaction management
  • PART 3 ADVANCED SPRING BATCH
  • Controlling execution
  • Enterprise integration
  • Monitoring jobs
  • Scaling and parallel processing
  • Testing batch applications

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Spring Batch in Action an online PDF/ePUB?
Yes, you can access Spring Batch in Action by Arnaud Cogoluegnes, Thierry Templier, Olivier Bazoud in PDF and/or ePUB format, as well as other popular books in Computer Science & Open Source Programming. We have over one million books available in our catalogue for you to explore.

Information

Publisher
Manning
Year
2011
ISBN
9781638352532

Part 1. Background

What is Spring Batch? What is it good for? Is it the right tool for you? You’ll find the answers to these questions in the next two chapters. Of course, you won’t be a Spring Batch expert by the end of this first part, but you’ll have a good foundation and understanding of all the features in Spring Batch.
Chapter 1 provides an overview of batch applications and Spring Batch. To follow the In Action tradition, we also show you how to implement a real-world batch job with Spring Batch. This introduction not only covers how Spring Batch handles the classical read-process-write pattern for large amounts of data but also shows you the techniques used to make a job more robust, like skipping invalid lines in a flat file.
Chapter 2 clearly defines the domain language used in batch applications and explains how Spring Batch captures the essence of batch applications. What are a job, a step, and a job execution? Chapter 2 covers all of this and introduces how Spring Batch tracks the execution of jobs to enable monitoring and restart on failure.

Chapter 1. Introducing Spring Batch

This chapter covers
  • Understanding batch applications in today’s architectures
  • Describing Spring Batch’s main features
  • Efficiently reading and writing data
  • Implementing processing inside a job with Spring Batch
  • Testing a Spring Batch job
Batch applications are a challenge to write, and that’s why Spring Batch was created: to make them easier to write but also faster, more robust, and reliable. What are batch applications? Batch applications process large amounts of data without human intervention. You’d opt to use batch applications to compute data for generating monthly financial statements, calculating statistics, and indexing files. You’re about to discover more about batch applications in this chapter. You’ll see why their requirements—large volumes of data, performance, and robustness—make them a challenge to implement correctly and efficiently. Once you understand the big picture, you’ll be ready to meet Spring Batch and its main features: helping to efficiently process data with various types of technologies—databases, files, and queues. We also honor the In Action series by implementing a real-world Spring Batch job. By the end of this first chapter, you’ll have an overview of what Spring Batch does, and you’ll be ready to implement your first job with Spring Batch. Let’s get started with batch applications!

1.1. What are batch applications?

The most common scenario for a batch application is exporting data to files from one system and processing them in another. Imagine you want to exchange data between two systems: you export data as files from system A and then import the data into a database on system B. Figure 1.1 illustrates this example.
Figure 1.1. A typical batch application: system A exports data to flat files, and system B uses a batch process to read the files into a database.
A batch application processes data automatically, so it must be robust and reliable because there is no human interaction to recover from an error. The greater the volume of data a batch application must process, the longer it takes to complete. This means you must also consider performance in your batch application because it’s often restricted to execute within a specific time window. Based on this description, the requirements of a batch application are as follows:
  • Large data volume— Batch applications must be able to handle large volumes of data to import, export, or compute.
  • Automation— Batch applications must run without user interaction except for serious problem resolution.
  • Robustness— Batch applications must handle invalid data without crashing or aborting prematurely.
  • Reliability— Batch applications must keep track of what goes wrong and when (logging, notification).
  • Performance— Batch applications must perform well to finish processing in a dedicated time window or to avoid disturbing any other applications running simultaneously.
How batch applications fit in today’s software architectures
Performing computations and exchanging data between applications are good examples of batch applications. But are these types of processes relevant today? Computation-based processes are obviously relevant: every day, large and complex calculations take place to index billions of documents, using cutting-edge algorithms like MapReduce. For data exchange, message-based solutions are also popular, having the advantage over batch applications of being (close to) real time. Although messaging is a powerful design pattern, it imposes its own particular set of requirements in terms of application design and implementation.
Clearly, messaging isn’t a silver bullet, and you should apply it thoughtfully. Note that batch jobs and messaging aren’t mutually exclusive solutions: you can use messaging to exchange data and still need batch applications to process the data with the same reliability and robustness requirements as the rest of your application stack. Even in our event- and notification-driven world, batch applications are still relevant!
How does Spring Batch fit in the landscape of batch applications? The next section introduces the Spring Batch framework and its main features. You’ll see how Spring Batch helps meet the requirements of batch applications by providing ready-to-use components and processing large amounts of data in an efficient manner.

1.2. Meet Spring Batch

The goal of the Spring Batch project is to provide an open source batch-oriented framework that effectively addresses the most common needs of batch applications. The Spring Batch project was born in 2007 out of the collaboration of Accenture and SpringSou...

Table of contents