天天看點

Spring Batch 文檔翻譯

Sptring Batch簡介(翻譯)

Spring Batch 文檔

1 Spring Batch 介紹

1.1背景

Many applications within the enterprise domain require bulk processing to perform business operations in mission critical environments. These business operations include automated, complex processing of large volumes of information that is most efficiently processed without user interaction.

在企業領域中,存在大量應用需要批處理程式執行業務操作在關鍵任務環境中。

業務操作指無需使用者接入的情況下高效的的,自動的,複雜的處理大量資訊。

These operations typically include time based events (e.g. month-end calculations, notices or correspondence), periodic application of complex business rules processed repetitively across very large data sets (e.g. Insurance benefit determination or rate adjustments), or the integration of information that is received from internal and external systems that typically requires formatting, validation and processing in a transactional manner into the system of record. Batch processing is used to process billions of transactions every day for enterprises.

業務操作通常包括:基于時間的事件(例如:每月底的計算,提醒或通知).

企業每天使用批處理程式處理海量事務。

Spring Batch is a lightweight, comprehensive batch framework designed to enable the development of robust batch applications vital for the daily operations of enterprise systems.

Spring batch 是一個輕量級的,完善的批處理系統,為企業系統中至關重要的周期性操作開發健壯的批處理應用。

Spring Batch builds upon the productivity, POJO-based development approach, and general ease of use capabilities people have come to know from the Spring Framework, while making it easy for developers to access and leverage more advance enterprise services when necessary. Spring Batch is not a scheduling framework. There are many good enterprise schedulers available in both the commercial and open source spaces such as Quartz, Tivoli, Control-M, etc. It is intended to work in conjunction with a scheduler, not replace a scheduler.

Spring batch 不是一個排程架構,存在很多好的商業和開源的企業排程器,例如: Quartz,Tivoli, Control-M等。

1.2使用場景

A typical batch program generally reads a large number of records from a database, file, or queue, processes the data in some fashion, and then writes back data in a modified form. Spring Batch automates this basic batch iteration, providing the capability to process similar transactions as a set, typically in an offline environment without any user interaction. Batch jobs are part of most IT projects and Spring Batch is the only open source framework that provides a robust, enterprise-scale solution.

大部分IT項目都包含批處理作業功能, Spring Batch 是唯一能夠提供健壯的,企業級的開源解決方案的開源架構。

Business Scenarios(業務場景)
  • Commit batch process periodically(周期性送出批處理)
  • Concurrent batch processing: parallel processing of a job(并行排程作業)
  • Staged, enterprise message-driven processing(分級的企業消息驅動處理)
  • Massively parallel batch processing(大量的并行批處理)
  • Manual or scheduled restart after failure(執行失敗後手動或按安排的重新開機)
  • Sequential processing of dependent steps (with extensions to workflow-driven batches)(存在依賴步驟的順序處理)
  • Partial processing: skip records (e.g. on rollback)(分拆處理)
  • Whole-batch transaction: for cases with a small batch size or existing stored procedures/scripts( 整體批處理 事務)
Technical Objectives(技術目标)
  • Batch developers use the Spring programming model: concentrate on business logic; let the framework take care of infrastructure.

    (使用Spring 程式設計模型,聚焦商業邏輯,由架構處理基礎設施)

  • Clear separation of concerns between the infrastructure, the batch execution environment, and the batch application.

    (在基礎設施,批處理執行環境和批處理應用之間存在清晰地區分)

  • Provide common, core execution services as interfaces that all projects can implement.(提供通用的,核心執行接口是所有項目均可使用)
  • Provide simple and default implementations of the core execution interfaces that can be used ‘out of the box’

    (通過為核心執行接口提供預設的簡單實作,實作開箱即用)

  • Easy to configure, customize, and extend services, by leveraging the spring framework in all layers.

    (基于spring 架構,易于配置,定制和擴充服務)

  • All existing core services should be easy to replace or extend, without any impact to the infrastructure layer.()
  • Provide a simple deployment model, with the architecture JARs completely separate from the application, built using Maven.

    (提供簡單部署模型,架構的jar與應用程式完全分離,使用Maven 建構)

2 Spring Batch 3.0 新特性

  • JSR-352 支援(新的 java 語言規範,為java 語言提供批處理能力,spring batch 3.0 完全支援這個規範)
  • 更新支援Spring 4和Java8
  • Promote Spring Batch Integration to Spring Boot(spring batch 完成整合到 spring boot 中)
  • JobScope 支援(3.0 中 job 支援作用域定義)
  • SQLite Support (SQLite 支援)

3 Batch 領域語言

To any experienced batch architect, the overall concepts of batch processing used in Spring Batch should be familiar and comfortable. There are “Jobs” and “Steps” and developer supplied processing units called ItemReaders and ItemWriters. However, because of the Spring patterns, operations, templates, callbacks, and idioms, there are opportunities for the following:
  • significant improvement in adherence to a clear separation of concerns
  • clearly delineated architectural layers and services provided as interfaces

    (清晰定義架構層次和服務提供接口)

  • simple and default implementations that allow for quick adoption and ease of use out-of-the-box(預設和簡單實作允許快速的采用和易于開箱即用)
  • significantly enhanced extensibility(顯著的增強擴充性)

4 配置并運作一個作業

5 配置 一個步驟

6 ItemReaders 和 ItemWriters