简体   繁体   English

链接春季批次步骤

[英]Chaining steps in spring batch

I was reading the spring documentation for spring batch project, I want to know if there is an out of the box configuration to chain steps, it means the output of the first step be the input for the second one and so on. 我正在阅读Spring Batch项目的Spring文档,我想知道是否有现成的配置来链接步骤,这意味着第一步的输出是第二步的输入,依此类推。 I'm not asking about step flows which one execute after other, is more about use the exit of the item processor of a step to be the input of the next one. 我不是在问一个接一个地执行的步骤流,更多的是关于将步骤的项目处理器的出口用作下一个的输入。

What I have in mind is use a normal step with reader, processor and in the writer create a flat file that could be reader by the second reader in the next step but this seems to be inefficiently as need to write objects that are in the jvm and restore them with the second reader. 我要记住的是在读取器,处理器中使用正常步骤,并在写入器中创建一个平面文件,该文件可以在下一步由第二个读取器读取,但这似乎效率很低,因为需要写入jvm中的对象并使用第二个阅读器还原它们。

If not sure if this is possible with spring normal config, or jsr does not work exactly as I want 如果不确定春季普通配置是否可行,或者jsr不能完全按照我的要求工作

Instead of multiple steps use multiple ItemProcessor s in a chain. 代替多个步骤,而是在链中使用多个ItemProcessor You can chain them using a CompositeItemProcessor . 您可以将它们使用链条CompositeItemProcessor

EDIT : I was reading about the spring batch strategies and I dont found any out of the box configuration in xml to chain the steps in a kind of pipeline, the best option that fit my needs is use ItemProcessorAdapter to run the different logic that I need in the steps and use CompositeItemProcessor (6.21) to make a chain of them. 编辑:我正在读关于Spring Batch的策略,我不发现任何现成的配置在XML中链在各种管道的步骤,适合我的需要最好的选择是使用ItemProcessorAdapter运行不同的逻辑,我需要在步骤中,并使用CompositeItemProcessor (6.21)进行链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM