[英]Spring Batch Chunk processing
When processing a step level using chunk processing(specifying a commit-interval) in Spring Batch,is there a way to know inside the Writer,when all the records in a file have been read and processed.My idea was to pass the collection of records read from the file to the ExecutionContext once all the records have been read. 当在Spring Batch中使用块处理(指定提交间隔)处理步骤级别时,是否有一种方法可以知道Writer内部的文件中的所有记录都已被读取和处理了。我的想法是传递读取所有记录后,从文件读取到ExecutionContext的记录。
Please help. 请帮忙。
I don't know if the is one of pre-built CompletionPolicy
that do what you want, but if none you can write a custom CompletionPolicy
that mark a chunk as completed when writer return null
; 我不知道它是否是可以CompletionPolicy
您想要的工作的预先构建的CompletionPolicy
之一,但是如果没有,您可以编写一个自定义的CompletionPolicy
,当作家返回null
时将其标记为已完成; in this way you hold all items read from file. 这样,您可以保留从文件读取的所有项目。
After that, are you sure this is exactly what you wnat? 之后,您确定这正是您所拥有的吗? because store all item in ExecutionContext is not a good pratice; 因为将所有项目存储在ExecutionContext中不是一个好习惯; also you will lose chunk processing, restartability, and all other SB features... 您还将失去块处理,可重新启动性以及所有其他SB功能...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.