Spring Batch Integration
许多 Spring Batch 用户可能会遇到超出 Spring Batch 范围却可以通过使用 Spring Integration 高效而简洁地实现的要求。相反,Spring Integration 用户可能会遇到 Spring Batch 要求,并且需要一种方法来有效集成这两种框架。在此上下文中,出现了多种模式和用例,Spring Batch Integration 满足了这些要求。
Many users of Spring Batch may encounter requirements that are outside the scope of Spring Batch but that may be efficiently and concisely implemented by using Spring Integration. Conversely, Spring Integration users may encounter Spring Batch requirements and need a way to efficiently integrate both frameworks. In this context, several patterns and use-cases emerge, and Spring Batch Integration addresses those requirements.
Spring Batch 和 Spring Integration 之间的界限并不总是不明确,但可以提供两条建议:考虑粒度和应用常用模式。本部分描述了其中一些常用模式。
The line between Spring Batch and Spring Integration is not always clear, but two pieces of advice can help: Thinking about granularity and applying common patterns. Some of those common patterns are described in this section.
向批处理流程添加消息传递可以实现操作自动化,还可以分离和制定关键关注点策略。例如,一条消息可能会触发一个作业执行,然后通过多种方式发送该消息。或者,当一个作业完成或失败时,该事件可能会触发发送消息,并且这些消息的使用者可能具有与应用程序本身无关的操作关注点。消息传递也可以嵌入到一个作业中(例如,通过通道读取或写入项目以进行处理)。远程分区和远程切块提供通过多个工作者分发工作负载的方法。
Adding messaging to a batch process enables automation of operations and also separation and strategizing of key concerns. For example, a message might trigger a job to execute, and then sending the message can be exposed in a variety of ways. Alternatively, when a job completes or fails, that event might trigger a message to be sent, and the consumers of those messages might have operational concerns that have nothing to do with the application itself. Messaging can also be embedded in a job (for example, reading or writing items for processing through channels). Remote partitioning and remote chunking provide methods to distribute workloads over a number of workers.
本部分涵盖以下关键概念:
This section covers the following key concepts: