Spring批

The world is moving very fast with the existence of technology. Enterprises and Corporations want to perform tasks faster and more accurately. The processing of such data includes daily report generation, processing bulk data without human intervention. Spring batch is the solution to most of these tasks. It enables processing of bulk data in a transactional manner and performs day to day activity with precision and speed.

随着技术的存在,世界正在快速发展。 企业和公司希望更快,更准确地执行任务。 此类数据的处理包括每日报告生成,无需人工干预即可处理大量数据。 Spring Batch是大多数任务的解决方案。 它使您能够以事务方式处理批量数据,并以高精度和速度执行日常活动。

Spring批 (Spring Batch)

  • Spring batch is based on spring framework and is very lightweight. The core concept of spring batch as the name suggests is processing of data in batches.

    Spring批处理基于Spring 框架 ,非常轻巧。 顾名思义,spring batch的核心概念是分批处理数据。
  • It is based on OOPS concepts and uses POJO based development.

    它基于OOPS概念并使用基于POJO的开发。
  • Spring Batch provides advance services and features for high volume and high performance batch jobs using optimization and partitioning techniques. It is highly scalable and can be used for processing of high amount of data.

    Spring Batch使用优化和分区技术为大量和高性能批处理作业提供了高级服务和功能。 它具有高度的可伸缩性,可用于处理大量数据。
  • It is not a scheduler and should be used in conjunction with a scheduler.

    它不是调度程序,应与调度程序结合使用。

为什么我们需要Spring Batch? (Why do we need Spring Batch?)

Let us go back into the history for looking into the need for spring batch.

让我们回顾一下历史,了解Spring批处理的需求。

While open source software projects and open source communities have majorly focused on web-based and messaging-based architecture frameworks, the reusable architecture frameworks took a back seat to accommodate Java-based batch processing needs, considering the continuous need to handle such processing on a daily basis within the enterprise.

尽管开源软件项目和开源社区主要关注基于Web和基于消息传递的体系结构框架,但考虑到持续需要在Web上处理此类处理,可重用的体系结构框架在满足基于Java的批处理需求方面处于次要地位。企业内部的日常基础。

The lack of a standard, scalable and reusable batch architecture resulted in the development of many in-house solutions from various companies.

缺乏标准的,可伸缩的和可重复使用的批处理体系结构,导致许多公司开发了许多内部解决方案。

SpringSource and Accenture collaborated to create something more standard and reusable. Having the proven technical experience in implementing batch architectures, SpringSource’s depth of technical experience and spring’s proven programming model together made a powerful architecture to create high-quality, market-relevant software aimed at filling an important gap in enterprise Java.

SpringSource埃森哲合作创建了更标准和可重用的工具。 SpringSource在实施批处理体系结构方面拥有公认的技术经验,其深厚的技术经验和spring久经验证的编程模型共同构成了一个强大的体系结构,可以创建高质量,与市场相关的软件,从而填补企业Java的重要空白。

Accenture contributed with previous proprietary batch processing architecture frameworks to the Spring Batch project along with support team, enhancements, and the future roadmap.

埃森哲与以前的专有批处理架构框架一起为Spring Batch项目做出了贡献,并提供了支持团队,增强功能和未来路线图。

Spring批处理用法 (Spring Batch Usage)

A batch program reads a large number of records from a database, file, or queue, processes the data based on the business needs, and then writes back data in the desired form.

批处理程序从数据库,文件或队列中读取大量记录,根据业务需求处理数据,然后以所需格式写回数据。

Spring Batch automates this basic batch iteration, providing the capability to process similar transactions as a set, all this can be done in an offline environment without any user interaction.

Spring Batch使这一基本的批处理迭代自动化,提供了将一组类似的交易作为一组处理的能力,所有这些都可以在离线环境中完成,而无需任何用户交互。

Batch jobs are part of most IT projects and Spring Batch is the only open source framework that provides a robust, enterprise solution.

批处理作业是大多数IT项目的一部分,Spring Batch是唯一提供可靠的企业解决方案的开源框架。

Let us look at some of the real-time usages of spring batch both business wise and technical.

让我们看看Spring批处理在业务上和技术上的一些实时用法。

Spring批业务用例 (Spring Batch Business Use Case)
  1. At the end of a month when a company has to send salary to its employee’s respective accounts.

    在一个月底公司必须将薪水发送到其员工的各自帐户中时。
  2. Processing of salary slips at month end is when spring batch can be used.

    月底可以使用Spring批处理工资单。
  3. Sending out mass communication emails.

    发送大众传播电子邮件。
  4. For generating automated reports on daily, weekly or monthly basis.

    用于每天,每周或每月生成自动报告。
  5. Executing business workflow automatically without human intervention.

    自动执行业务工作流程,无需人工干预。
Spring Batch技术用例 (Spring Batch Technical Use Cases)
  1. For automatic test execution at a defined frequency.

    用于以定义的频率自动执行测试。
  2. This can be used for doing automatic database updates on a predefined frequency.

    这可以用于以预定频率进行自动数据库更新。
  3. It can be used with a queue system to handle huge amount of transactions without any failure.

    它可以与队列系统一起使用,以处理大量事务而不会发生任何故障。
  4. Spring batch can be used along with APIs to perform tasks such as health check for server or application, dummy data generation for load test, etc.

    Spring Batch可以与API一起使用,以执行诸如服务器或应用程序的运行状况检查,负载测试的虚拟数据生成等任务。

Spring批处理架构 (Spring Batch Architecture)

The diagram below shows the technical architecture of Spring Batch.

下图显示了Spring Batch的技术架构。

  1. Application: This contains all the batch jobs and code written by the developer based on business needs.

    应用程序 :包含开发人员根据业务需要编写的所有批处理作业和代码。
  2. Batch Core: It contains the runtime classes necessary to run a batch job. The classes such are JobLauncher, Job and Step implementation are part of the Batch Core.

    批处理核心 :它包含运行批处理作业所需的运行时类。 JobLauncher,Job和Step实现等类是Batch Core的一部分。
  3. Batch Infrastructure: This contains the reader and writer services which are used by developer and the framework itself. The classes are ItemReader and ItemWriter. It also contains services to retry read and write.

    批处理基础结构:包含开发人员和框架本身使用的读取器和写入器服务。 这些类是ItemReaderItemWriter 。 它还包含重试读取和写入的服务。

Spring批处理 (Spring Batch Processing)

A regular spring batch processing workflow is shown below.

常规的弹簧批处理工作流程如下所示。

  1. In the workflow shown, the data is read from database using reader which is part of the Spring Batch.

    在所示的工作流程中,使用作为Spring Batch一部分的读取器从数据库读取数据。
  2. Then the data is passed to processor for processing the data based on the business requirement.

    然后,将数据传递到处理器以根据业务需求处理数据。
  3. The processed data which is now modified data is passed to the writer, which writes the data back into the database.

    现在将已处理的数据(已修改的数据)传递给写入器,写入器将数据写回到数据库中。
  4. The source of data can be Database, file, queue etc.

    数据源可以是数据库,文件,队列等。

Spring Batch的优势 (Spring Batch Advantages)

Let’s see the advantages of using Spring Batch processing.

让我们看看使用Spring Batch处理的优势。

  • Developers can concentrate on implementation of business logic and framework will take care of the iterations.

    开发人员可以专注于实现业务逻辑,而框架将负责迭代。
  • Since it is a layered architecture the decoupling between different layers is easy.

    由于它是分层体系结构,因此不同层之间的去耦很容易。
  • You can implement a core business logic that can be used as generic implementation throughout the application.

    您可以实现一个核心业务逻辑,该逻辑可以在整个应用程序中用作通用实现。
  • It provides separation between infrastructure and application at the JAR level as well resulting in easy and scalable deployment.

    它在JAR级别上将基础结构和应用程序分隔开来,从而实现了轻松且可扩展的部署。

That’s all for a quick introduction of Spring Batch.

这就是快速介绍Spring Batch的全部内容。

Spring Batch Example to learn how to implement Spring Batch in your applications. Spring Batch Example以了解如何在您的应用程序中实现Spring Batch。

Reference: Project Official Page

参考: 项目官方页面

翻译自: https://www.journaldev.com/17119/spring-batch

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值