简体   繁体   中英

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. 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.

If not sure if this is possible with spring normal config, or jsr does not work exactly as I want

Instead of multiple steps use multiple ItemProcessor s in a chain. You can chain them using a 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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