Spring Batch 简明教程

Spring Batch - Overview

Batch processing 是处理模式,此模式涉及在用户不进行交互的情况下执行一系列自动化复杂任务。批处理处理批量数据,且运行很长时间。

Batch processing is a processing mode which involves execution of series of automated complex jobs without user interaction. A batch process handles bulk data and runs for a long time.

需要处理大量数据以执行涉及操作的多个企业应用程序 −

Several Enterprise applications require to process huge data to perform operations involving −

  1. Time-based events such as periodic calculations.

  2. Periodic applications that are processed repetitively over large datasets.

  3. Applications that deals with processing and validation of the data available in a transactional manner.

因此,批处理用于企业应用程序以执行此类事务。

Therefore, batch processing is used in enterprise applications to perform such transactions.

What is Spring Batch

Spring Batch 是一款 lightweight framework ,此类用于开发企业应用程序中使用的 Batch Applications

Spring batch is a lightweight framework which is used to develop Batch Applications that are used in Enterprise Applications.

除了批量处理外,此框架还提供以下功能 −

In addition to bulk processing, this framework provides functions for −

  1. Including logging and tracing

  2. Transaction management

  3. Job processing statistics

  4. Job restart

  5. Skip and Resource management

你还可以使用其分区技术来扩展 Spring Batch 应用程序。

You can also scale spring batch applications using its portioning techniques.

Features of Spring Batch

以下是 Spring Batch 的著名功能 −

Following are the notable features of Spring Batch −

  1. Flexibility − Spring Batch applications are flexible. You simply need to change an XML file to alter the order of processing in an application.

  2. Maintainability − Spring Batch applications are easy to maintain. A Spring Batch job includes steps and each step can be decoupled, tested, and updated, without effecting the other steps.

  3. Scalability − Using the portioning techniques, you can scale the Spring Batch applications. These techniques allow you to − Execute the steps of a job in parallel. Execute a single thread in parallel.

  4. Reliability − In case of any failure, you can restart the job from exactly where it was stopped, by decoupling the steps.

  5. Support for multiple file formats − Spring Batch provides support for a large set of readers and writers such as XML, Flat file, CSV, MYSQL, Hibernate, JDBC, Mongo, Neo4j, etc.

  6. Multiple ways to launch a job − You can launch a Spring Batch job using web applications, Java programs, Command Line, etc.

除了这些之外,Spring Batch应用程序支持−

In addition to these, Spring Batch applications support −

  1. Automatic retry after failure.

  2. Tracking status and statistics during the batch execution and after completing the batch processing.

  3. To run concurrent jobs.

  4. Services such as logging, resource management, skip, and restarting the processing.