简体   繁体   English

一步之内的Spring Batch

[英]Spring Batch within a Step

I am trying to see if the following can done in Spring Batch. 我正在尝试看看是否可以在Spring Batch中完成以下操作。 A Step is invoked for one ItemReader/Processor/Writer. 为一个ItemReader / Processor / Writer调用一个Step。 Before this step completes,can the next Step(with its own Reader/Processor/Writer) be invoked for some processing and then return to the previous step. 在此步骤完成之前,可以调用下一个步骤(带有其自己的Reader / Processor / Writer)进行某些处理,然后返回上一步。

To be more clear, in the processor of the first step I am putting a List into the executionContext hoping for the process in the second step to pick it up for further processing after which the program goes back to the processor of the first step to build a list and set it into the context again for it to be picked up by the second step so on and so forth. 更清楚地说,在第一步的处理器中,我将一个List放入executionContext希望第二步中的进程将其拾取以进行进一步处理,然后程序返回到第一步的处理器中进行构建列表,然后再次将其设置为上下文,以便第二步对其进行选择,依此类推。

It looks to me as if you are trying to do something, which spring-batch is not meant for. 在我看来,您似乎正在尝试做某事,而这并不意味着弹簧批处理。

First, spring-batch processes every step completely. 首先,spring-batch会完全处理每个步骤。 Only then, the next step is executed. 只有这样,才执行下一步。 You can start two steps in parallel, but then, they have different inputs and produce different outputs. 您可以并行开始两个步骤,但是它们具有不同的输入并产生不同的输出。

Moreover, your approach to put "business"-data into the executionContext and use it as a transport-container between steps, is strange as well. 此外,将“业务”数据放入executionContext并将其用作步骤之间的传输容器的方法也很奇怪。

Generally, a "normal" reader-processor-writer step works the following way: 1. it reads a chunk of entries from the source 2. it processes every read item of the chunk individually in the processor 3. it writes the whole chunk to the target 4. it starts with the next chunk with step 1 5. after the reader has read all available items, the job advances to the next step. 通常,“正常”的读取器-处理器-写入器步骤按以下方式工作:1.从源中读取一大块条目; 2.在处理器中单独处理该块的每个读取项; 3.将整个块写入到目标4.从第1步的下一个块开始。5.阅读器阅读完所有可用项目后,作业前进到下一步。

It would probably help, if you explain, what your final goal is. 如果您做出解释,这可能会帮助您实现最终目标。 As far as I see, I'm afraid you are going down the wrong track. 据我所知,恐怕您走错了路。

Could it be, that you are trying to group items together? 可能是您正在尝试将项目分组在一起吗? There are solutions for that. 有解决方案。

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

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