我发现有 3 个项目:
我无法理解 spring-integration
和 spring-batch
之间的区别。我知道 spring batch 是关于批处理、关于多步骤作业、关于分区、statitistcs、异常处理,如果我们在 2GB CSV 文件中失败了,我们可以稍后从那个地方继续。
我尝试在 google 上搜索 spring batch 的一些示例,并找到了读取器和写入器可以完全不同的示例(文件、数据库、消息队列、sftp 文件等)
我最初认为 spring 集成是一组方便的连接器,连接到不同的端点,如文件、数据库、消息队列、sftp 文件等,但看起来 spring batch 可以做到。
能否请您提供任何使用 spring batch 和 spring integration 的用例,以及我何时需要它们?
最佳答案
同时 Spring Batch用于启 Action 业和编写批处理应用程序,Spring Integration是另一个项目(如文档中所述)用于在基于 Spring 的应用程序中启用轻量级消息传递,并支持通过声明性适配器与外部系统集成。
所以基本上这是两个完全不同的项目,旨在处理/操作各自不同的级别,并且用于另一个无法处理的不同类型的需求,这就是为什么 spring-batch-integration
旨在允许同时使用这两个项目,并从两个项目中获利以满足相同的需求。
您可以在 Spring Batch Integration Introduction section of the Docs 中看到它说:
Many users of
Spring Batch
may encounter requirements that are outside the scope ofSpring Batch
but that may be efficiently and concisely implemented by usingSpring Integration
. Conversely,Spring Integration
users may encounterSpring 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 集成流程的批处理作业,甚至需要启动 Spring 批处理作业的 Spring 集成流程。
关于java - spring-integration 和 spring-batch 项目有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57291557/