Chapter 12. Monitoring jobs
This chapter covers
- Understanding the job metadata managed by Spring Batch
- Using Spring Batch objects to interact with the job metadata
- Monitoring jobs
In the real world, errors occur when running batch jobs. Batch jobs exchange data between different information systems and tools, and it’s not always easy to guarantee consistency among these systems. Detecting job errors is more difficult because jobs don’t require user interaction during execution. Detecting errors is also more challenging because applications generally execute batch jobs in the background.
In some cases, rerunning batch jobs is enough to solve problems, such as when a system like a database is temporarily down. When errors are caused by bad data, running the batch job again won’t solve the problem. Because batch jobs run mainly in the background, receiving notifications when errors occur is critical. How do you solve this problem? You provide support in your application for batch monitoring and management.
Batch monitoring tracks batch job executions. Spring Batch makes it possible to monitor a job because it collects data on job and step executions and saves it to a database. Spring Batch provides classes to access the database and acts as the foundation for monitoring tools.